_.fromPairs(_(relationships) .map(relationship => ([ relationship.alias, [_.merge({}, _.get(data, relationship.path), {host: `${relationship.alias}.internal`})], ])) .value())
return _.filter(containers, _.fromPairs(_.map(options.filter, filter => filter.split('=')))); } else { return containers;
const serviceData = _.fromPairs(data); app.log.debug('collected open data from platform services', serviceData);
function buildFilterParams (filters) { const filterParams = Object.assign({}, filters) if (filters.tags) { const tagParams = filters.tags.map((tag, index) => [`tag${index + 1}`, tag]) Object.assign(filterParams, _.fromPairs(tagParams)) } return filterParams }
function diffShallow(o1, o2) { return _.fromPairs( _.differenceWith( _.toPairs(o1), _.toPairs(o2), function (e1, e2) { return (e1[0] == e2[0] && e1[1] == e2[1]); } ) ); }
/** * CSS code of style * @type {String} * @memberOf module:models/style~Style * @name rawCSS * @instance * @readOnly */ styleSchema.virtual('rawCSS').get(function () { const colors = this.colors ? _.fromPairs(Array.from(this.colors.entries())) : {}; const variables = this.variables ? _.fromPairs(Array.from(this.variables.entries())) : {}; const strings = this.strings ? _.fromPairs(Array.from(this.strings.entries())) : {}; return userStyleTemplate({ colors: colors, variables: variables, strings: strings, css: this.css, }); });
const separateEnvsFromString = str => _.reduce( str.split(' '), (task, substr, index, array) => { if (/^([a-zA-Z]{1,2}[a-zA-Z_0-9]{1,})=([a-zA-Z0-9]{1,})$/.test(substr)) { _.assign(task.envs, _.fromPairs([substr.split('=')])) } else { task.string.push(substr) } if (index === array.length - 1) { task.string = task.string.join(' ') } return task }, { string: [], envs: {}, } )
return noSuchBoard.respond(res); const updateQuery = _.fromPairs([[`boardRoles.${ board }`, role._id]]); const status = await User.findByIdAndUpdate(staffMember._id, updateQuery, { runValidators: true, rawResult: true }); res.json(_.pick(status, ['ok']));
_.fromPairs( _.map( ANSI_COLOR_MAP, ( ansiColorName, colorKey ) => { return [ colorKey, themeColors[ ansiColorName ] ]; } ) )
fp.map(_.fromPairs), fp.partition(([k, v]) => _.has(posts, k)), fp.entries,
task.storage = _.fromPairs(_.map(_.filter(_.keys(storage), key => key !== 'localSession' && key !== 'callbacks' && key !== 'defaultCallbacks'), (key) => { return [key, storage[key]] }))
router.patch('/api/user/role', [ apiAuthRequired, adminOnly, body('user').exists().withMessage('user is required'), body('role').exists().withMessage('role is required'), body('board').exists().withMessage('board is required'), validateRequest, getStaffMember, checkUserAuthority, ], async (req, res, next) => { try { const role = await Role.findOne({ roleName: req.body.role }); const board = req.body.board; const staffMember = req.body.staffMember; if (staffMember.boardRoles && !staffMember.boardRoles.has(board)) { const noSuchRole = new DocumentNotFoundError('Role for board', 'board', board, 'body'); return noSuchRole.respond(res); } const updateQuery = _.fromPairs([[`boardRoles.${ board }`, role._id]]); const status = await User.findByIdAndUpdate(staffMember._id, updateQuery, { runValidators: true, rawResult: true }); res.json(_.pick(status, ['ok'])); } catch (err) { next(err); } } );
function buildFilterParams (filters) { const filterParams = Object.assign({}, filters) if (filters.tags) { const tagParams = filters.tags.map((tag, index) => [`tag${index + 1}`, tag]) Object.assign(filterParams, _.fromPairs(tagParams)) } return filterParams }