function addPatchesToDependency (dependency, packageName, flags) { if (dependency.dependencies) { forEach(dependency.dependencies, function (subDependency, subPackageName) { addPatchesToDependency(subDependency, subPackageName, flags) }) } var patches = flags[packageName + '@' + dependency.version] if (patches) { dependency.patches = patches } }
function exerciseFunc(func, specPath) { const specFile = require(specPath); s.fdef(func, specFile); const specs = map(s.exerciseFn(func), ([, s]) => s); forEach(specs, s.exercise); }
forEach(config.styleguideComponents, (filepath, name) => { const fullName = name.match(RENDERER_REGEXP) ? `${name.replace(RENDERER_REGEXP, '')}/${name}` : name; webpackConfig.resolve.alias[`rsg-components/${fullName}`] = filepath; });
export function formatLanguageLocale(data) { const array = []; forEach(split(data, '_'), (value, key) => { if (key === 0){ array.push(toLower(value)); } else { array.push(upperCase(value)); } }); return array; }
const loadArchServices = function (archServicesList, appConfig) { return co(function* () { if (!archServicesList && !archServicesList.length) { return; } const loadedServices = []; forEach(archServicesList, (serviceName) => { loadedServices.push( createService(serviceName, appConfig) ); }); yield Promise.all(loadedServices); }); }
const handler = function (component) { return new Promise ((resolve) => { // create models. forEach(keys(component), (key) => { component[key] = mongoose.model(key, component[key]); }); return resolve(component); }); }
this.collectDependencies(function (error, dependencies) { if (error) { debug.error('sendDependencies', format('error collecting dependencies: %s', error.stack)) return } self.collectSnykFlags(function (_error, flags) { if (_error) { debug.error('sendDependencies', format('error collecting snyk flags: %s', _error.stack)) // send dependencies without patches self.collectorApi.sendDependencies(dependencies) return } forEach(dependencies, function (dependency, packageName) { addPatchesToDependency(dependency, packageName, flags) }) self.collectorApi.sendDependencies(dependencies) }) })
const body = {}; forEach(this.props.home.modifiedData, (value, key) => { if (value !== prevSettings[key] && key !== 'security.xframe.value.nested') { body[key] = value; forEach(body, (bodyValue, target) => { if (includes(target, 'enabled') && !bodyValue) disabledSections.push(split(target, '.')[1]); }); forEach(disabledSections, (sectionName) => { forEach(body, (v, bodyKey) => { if (!includes(bodyKey, 'enabled') && includes(bodyKey, sectionName)) { unset(body, bodyKey);
/* eslint-disable consistent-return */ export function getValidationsFromForm(form, formValidations) { map(form, (value, key) => { // Check if the object if (isObject(value) && !isArray(value)) { forEach(value, (subValue) => { // Check if it has nestedInputs if (isArray(subValue) && value.type !== 'select') { return getValidationsFromForm(subValue, formValidations); } }); } if (isArray(value) && value.type !== 'select') { return getValidationsFromForm(form[key], formValidations); } // Push the target and the validation if (value.name) { formValidations.push({ name: value.name, validations: value.validations }); } }); return formValidations; }
let images = []; forEach(chunkedImgs, function(imgs, index) { let firstImgWidth = random(32, 67); let secondImgWidth = 100 - firstImgWidth;
export function generateStackData() { const data = []; times(10, (index) => { const stack = { index, }; forEach(STACKED_BAR_KEYS, (key) => { stack[key] = rand(0, 100); }); data.push(stack); }); return data; }
const toUpdate = []; forEach(periodDelta.data, (values, metric) => { const { gained } = values[getMeasure(metric)];
const loadArchPlugins = function (archPluginsList, components) { return co(function* () { const loadedPlugins = []; forEach(archPluginsList, (pluginName) => { loadedPlugins.push( createPlugin(pluginName, components) ); }); yield Promise.all(loadedPlugins); }); }
/* eslint-disable consistent-return */ export function getValidationsFromForm(form, formValidations) { map(form, (value, key) => { // Check if the object if (isObject(value) && !isArray(value)) { forEach(value, (subValue) => { // Check if it has nestedInputs if (isArray(subValue) && value.type !== 'select') { return getValidationsFromForm(subValue, formValidations); } }); } if (isArray(value) && value.type !== 'select') { return getValidationsFromForm(form[key], formValidations); } // Push the target and the validation if (value.name) { formValidations.push({ name: value.name, validations: value.validations }); } }); return formValidations; }