export function getSitesWithPlugin( state, siteIds, pluginSlug ) { const pluginList = getPlugins( state, siteIds ); const plugin = find( pluginList, { slug: pluginSlug } ); if ( ! plugin ) { return []; } // Filter the requested sites list by the list of sites for this plugin const pluginSites = filter( siteIds, ( siteId ) => { return plugin.sites.hasOwnProperty( siteId ); } ); return sortBy( pluginSites, ( siteId ) => getSiteTitle( state, siteId ).toLowerCase() ); }
function generateBinArgs( name ) { if ( Object.prototype.hasOwnProperty.call( config.codemodArgs, name ) ) { // Is the codemod defined in the codemodArgs object? return config.codemodArgs[ name ]; } if ( getLocalCodemodFileNames().includes( name ) ) { return [ `--transform=${ transformsDir }/${ name }.js` ]; } throw new Error( `"${ name }" is an unrecognized codemod.` ); }
// Check if object is empty export function isEmpty(obj) { let name; for (name in obj) { if (obj.hasOwnProperty(name)) { return false; } } return true; }
_.map(this.series, (series, id) => { let seriesLabel = ""; if (this.seriesOptions[id].label) { seriesLabel = `${this.seriesOptions[id].label} `; } else if (!this.seriesOptions[id].hasOwnProperty("label")) { seriesLabel = `${id} `; } return util.format("%s(%d%s)", seriesLabel, _.last(this.series[id].y), this.unit); }).join(", ")
test('GPU.createKernel settings outputToTexture true', () => { const gpu = new GPU(); const kernel = gpu.createKernel(function() {}, { outputToTexture: true }); assert.equal(kernel.pipeline, true); assert.notOk(kernel.kernel.hasOwnProperty('outputToTexture')); gpu.destroy(); });
const fillInsufficientProps = (values, props) => { Object.keys(values).forEach((key) => { if (!props.hasOwnProperty(key)) { props[key] = values[key] } }) }
static addKeys(value, table) { if (Array.isArray(value)) return; table = table || {}; let i = Object.keys(table).length; for (const p in value) { if (!value.hasOwnProperty(p)) continue; if (table.hasOwnProperty(p)) continue; table[p] = i++; } return table; }
/** * @desc Return WebGlUniformLocation for various variables * related to webGl program, such as user-defined variables, * as well as, dimension sizes, etc. */ getUniformLocation(name) { if (this.programUniformLocationCache.hasOwnProperty(name)) { return this.programUniformLocationCache[name]; } return this.programUniformLocationCache[name] = this.context.getUniformLocation(this.program, name); }
walkIdentifier(node, context) { if ({}.hasOwnProperty.call(context, node.name)) { return context[node.name]; } return this.failResult; }
function getNormalizedKey(key) { const normalizedKey = getNormalizedKeyAttributeValue(key); if (key !== normalizedKey) { this.debugSection('Input', `Mapping key '${key}' to '${normalizedKey}'`); } // Use key definition to ensure correct key is displayed when Shift modifier is active if (Object.prototype.hasOwnProperty.call(keyDefinitionMap, normalizedKey)) { return keyDefinitionMap[normalizedKey]; } return normalizedKey; }
createEventUpdate (item) { if (!item.hasOwnProperty('createdAt')) { item.createdAt = item.updatedAt // for backward compatibility } return new MaintenanceUpdate(item) }
walkThis(node, context) { if ({}.hasOwnProperty.call(context, 'this')) { // eslint-disable-next-line return context["this"]; } return this.failResult; }
static toArrayShort(lookup, object) { const result = []; for (const p in lookup) { if (!object.hasOwnProperty(p)) break; result[lookup[p]] = object[p]; } return Float32Array.from(result); }
export function dump(obj) { let out = ''; for (const key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { out += `${key}: ${obj[key]}\n`; } } return out; }
test('GPU.createKernel settings outputImmutable true', () => { const gpu = new GPU(); const kernel = gpu.createKernel(function() {}, { outputImmutable: true }); assert.equal(kernel.immutable, true); assert.notOk(kernel.kernel.hasOwnProperty('outputImmutable')); gpu.destroy(); });