test( 'should error when url is not a string', () => { const types = [ {}, undefined, 1, true, [], function () {} ]; types.forEach( ( type ) => { expect( () => { addQueryArgs( {}, type ); } ).toThrow( Error ); } ); } );
function iterateOnTypeKeysToAddNestedSchemas(type, schema, isArray) { Object.keys(type).forEach((key) => { addNestedSchemaToParentSchema(type[key], schema, isArray ? 0 : key); }); }
setFilePriority(options) { const fileIndices = getEnsuredArray(options.fileIndices); const hashes = getEnsuredArray(options.hashes); hashes.forEach(hash => { fileIndices.forEach(fileIndex => { this.requests.push(getMethodCall('f.priority.set', [`${hash}:f${fileIndex}`, options.priority])); }); this.requests.push(getMethodCall('d.update_priorities', [hash])); }); }
handleSettingsFetchSuccess(settings) { this.fetchStatus.floodSettingsFetched = true; Object.keys(settings).forEach(property => { const incomingSettingsValue = settings[property]; if (incomingSettingsValue != null) { this.floodSettings[property] = incomingSettingsValue; } }); this.emit(EventTypes.SETTINGS_FETCH_REQUEST_SUCCESS); this.processSettingsState(); }
fs.readdirSync(themesDir).forEach(th => { if (!th.endsWith(".json")) return; th = th.replace(".json", ""); if (th === window.settings.theme) return; themes += `<option>${th}</option>`; });
constructor() { super(); this.id = _.uniqueId('dropdown_'); this.state = { isOpen: false, }; METHODS_TO_BIND.forEach(method => { this[method] = this[method].bind(this); }); this.handleKeyPress = _.throttle(this.handleKeyPress, 200); }
// foreach service services.forEach((service) => { // if the service has a controllers object if (service[1].get().controllers) { Object.assign(routes, service[1].get().controllers); } });
describeMongoDatabases(tests) { mongoDatabases.forEach((mongoDatabase) => { // eslint-disable-next-line jest/valid-describe describe(`using Mongo Database v${mongoDatabase.version}`, tests(mongoDatabase.url)); }); }
// Associate all model // Run `.associate` if it exists, // ie create relationships in the ORM Object.values(models) .filter((model) => typeof model.associate === 'function') .forEach((model) => model.associate(models));
async emptyQueue() { this.queue.forEach(func => { func(); }); }
Object.keys(publicEnv).forEach(key => { if (!process.env[key]) { process.env[key] = publicEnv[key]; } });
constructor() { super(); METHODS_TO_BIND.forEach(method => { this[method] = this[method].bind(this); }); this.container = null; this.state = {isOpen: false, wasTriggeredClose: false}; }
constructor() { super(); this.state = { optimisticData: {currentStatus: null}, }; METHODS_TO_BIND.forEach(method => { this[method] = this[method].bind(this); }); }
constructor() { super(); this.tooltipRef = null; METHODS_TO_BIND.forEach(method => { this[method] = this[method].bind(this); }); }
fs.readdirSync(themesDir).forEach(th => { if (!th.endsWith(".json")) return; th = th.replace(".json", ""); if (th === window.settings.theme) return; themes += `<option>${th}</option>`; });