app.init().then(() => { if (_.isNull(user)) user = getUser(service, app.info); return lando.engine.run(utils.buildCommand(app, command, service, user)).catch(error => { error.hide = true; throw error; }); })
if (!_.isNull(coercedDrushVersion) && semver.gte(coercedDrushVersion, '10.0.0')) { options._app.addWarning(warnings.drushWarn(options.drush));
_(cmdArgs) .omit(_.isUndefined) .omit(_.isNull) .mapValues((property)=>{ return property === 'true' ? true : property === 'false' ? false : property }).value()
process.on('SIGTERM',function(){ global.logger.info('Attempting a graceful shutdown...'); if(!_.isNull(cbts)&&!_.isUndefined(cbts)){ cbts.endWrap(); } });
hasPermission(perm, token, next) { const tokenData = Cache.get(`auth:token:${token}`); if (_.isNull(tokenData)) { this.getTokenData(token, (err, data) => { if (err) return next(err); Cache.put(`auth:token:${token}`, data, data.expires_at); return this.validatePermission(data, perm, next); }); } else { return this.validatePermission(tokenData, perm, next); } }
constructor() { if (_.isNull(Cache.get('config'))) { Cache.put('config', this.raw()); } }
save(json, next) { if (!json || !_.isObject(json) || _.isNull(json) || !_.keys(json).length) { throw new Error('Invalid JSON was passed to Builder.'); } Fs.writeJson('./config/core.json', json, { spaces: 2 }, err => { if (!err) Cache.put('config', json); return next(err); }); }
Async.eachOf(config.env, (value, index, eachCallback) => { if (_.isNull(value)) return eachCallback(); environment.push(Util.format('%s=%s', index, value)); return eachCallback(); }, callback);
function* explainInvalid(value, predicates, options) { const problems = _.map(predicates, predicate => explainData(predicate, value, options)); const found = _.find(problems, p => !_.isNull(p)); if (found) { yield found.problems[0]; } }
static parsePostParams(post={}) { let form, formData, sortedPost; if (post.embed && typeof post.embed !== 'string') { formData = post; post = _.omit(post,'embed'); } else if (!_(post).isEmpty()) { form = post; } sortedPost = _(post).omit(_.isUndefined).omit(_.isNull).sortBy((val, key) => key).toString(); return {form, formData, sortedPost}; }
_valueOnQuery(value) { if (_.isNull(value)) { return 'null'; } else if (_.isString(value)) { return `'${value}'`; } if (_.isDate(value)) { return `${value.getTime()}`; } else { return `${value}`; } }
//Transform CSV data function transformCSVRowFromMetadata(row, numericCols) { var val; _.forEach(numericCols, function (col) { if (!_.isNull(row[col])) row[col] = _.toNumber(row[col]); else row[col] = null; }); return row; }
// Faking processing time setTimeout(() => { post = _.find(posts, ['id', _.toInteger(postId)]); if(_.isNull(post)) { throw new Error({'success': false}) } resolve({'success': true, 'data': post}) }, 2000);
process.on('SIGINT',function(){ if(!_.isNull(cbts)&&!_.isUndefined(cbts)){ cbts.endWrap(); } global.logger.info('\nAttempting a graceful shutdown...'); });
_valueForArray(array) { return array.reduce((result, current) => { if (_.isString(current) || _.isNumber(current) || _.isNull(current)) { return result + `${(result === '') ? '' : ','} ${this._valueOnQuery(current)} `; } return result; }, ''); }