beforeEach( () => { selector = jest.fn( ( [ posts ], siteId ) => Object.values( posts ).filter( ( p ) => p.siteId === siteId ) ); getDependents = jest.fn( ( state ) => [ state.posts ] ); getSitePosts = treeSelect( getDependents, selector ); } );
const FilterInput = ({ member, updateMethods }) => { const Filter = FilterInputs[member.dimension.type] || FilterInputs.string; return ( <Filter key="filter" values={member.values} onChange={(values) => updateMethods.update(member, { ...member, values })} /> ); }
/** * @param {Map} map */ function convertMapToIndexedInterface(map) { return [...map.values()].map((value, i) => `[${i}]: ${value}`).join('; '); }
/** * All custom emojis that the client has access to, mapped by their IDs * @type {GuildEmojiManager} * @readonly */ get emojis() { const emojis = new GuildEmojiManager({ client: this }); for (const guild of this.guilds.cache.values()) { if (guild.available) for (const emoji of guild.emojis.cache.values()) emojis.cache.set(emoji.id, emoji); } return emojis; }
function rulesToJson(body) { if (body && /^\{[\s\S]+\}$/.test(body)) { try { body = JSON.parse(body); return { root: typeof body.root === 'string' ? body.root : null, text: typeof body.rules === 'string' ? body.rules : '', values: body.values }; } catch(e) {} } }
function validate (opts) { if (opts.category && !R.contains(opts.category, R.values(c.category))) { throw Error('Invalid category ' + opts.category); } opts.collection = opts.collection || c.collection.TOP_FREE; if (!R.contains(opts.collection, R.values(c.collection))) { throw Error(`Invalid collection ${opts.collection}`); } if (opts.age && !R.contains(opts.age, R.values(c.age))) { throw Error(`Invalid age range ${opts.age}`); } }
dataCenter.values.add({name: name}, function(data, xhr) { if (data && data.ec === 0) { var item = modal.add(name); self.setValuesActive(name); self.setState({ activeValues: item }); } else { util.showSystemError(xhr); } });
prompt.run() .then(answer => { console.log('Answer:', answer.values); console.log('---'); console.log(answer.rendered); }) .catch(console.error);
static fromJSON(json) { const dataFormatter = new DataFormatter(); dataFormatter.indexTable = json.indexTable; dataFormatter.characterTable = json.characterTable; dataFormatter.values = json.values; dataFormatter.characters = json.characters; dataFormatter.specialIndexes = json.specialIndexes; return dataFormatter; }
var getRulesStr = function(obj) { obj = JSON.stringify({ rules: typeof obj === 'string' ? obj : obj.rules, values: obj.values, root: options.value }); return encodeURIComponent(obj); }
/** * @description Get all discovered devices, and if device already created, the Gladys device. * @returns {*} Discovered devices. * @example * getDiscoveredDevices() */ function getDiscoveredDevices() { const discovered = Object.values(this.mqttDevices).map((d) => { return this.mergeWithExistingDevice(d); }); return discovered; }
firstValue(key) { const set = this._map.get(key); if (!set) return null; return set.values().next().value; }
createSelector( ( state, organizationId ) => { // remove subs where the sub has an error return sortBy( values( state.reader.follows.items ).filter( ( blog ) => blog.organization_id === organizationId ), sorter ); }, ( state ) => [ state.reader.follows.items, state.currentUser.capabilities ] )
test('The schemas should be accessible via getSchemas', t => { t.plan(1) const fastify = Fastify() const schemas = { id: { $id: 'id', my: 'schema' }, abc: { $id: 'abc', my: 'schema' }, bcd: { $id: 'bcd', my: 'schema', properties: { a: 'a', b: 1 } } } Object.values(schemas).forEach(schema => { fastify.addSchema(schema) }) t.deepEqual(fastify.getSchemas(), schemas) })
queueArray(queueObj, orderFilterLessThan) { return R.pipe( R.values, R.filter(orderFilterLessThan ? q => q.order < orderFilterLessThan : R.identity), R.sortBy(q => q.order), R.map(q => q.key) )(queueObj); }