prompt.get([ { name: 'app', description: 'GitHub repository or selection?', default: '1', required: true } ], function(err, results) { if (err) { return done(err); } if (results.app.indexOf('https://github.com/') !== -1) { application = results.app; } else { const selection = parseInt(results.app, 10); if (_.isNumber(selection)) { if ((selection > 1) && (selection <= repos.length)) { application = repos[selection - 1]; } } } // Replace github.com url. application = application.replace('https://github.com/', ''); done(); });
return _.isNumber(item); });
isString: function (value) { return _.isString(value) }, isEmail: function (value) { return /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(value) }, isNumber: function (value) { return _.isNumber(value) }, isObject: function (value) { return _.isObject(value) }, isArray: function (value) { return _.isArray(value) }, case 'isString': return _.isString(item); break; case 'isEmail': return /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(value); break; case 'isNumber': return _.isNumber(item); break; case 'isObject': return _.isObject(item); break; case 'isArray': return _.isArray(item); break;
historyMaxSizeSet (historyMaxSize) { if (_.isNumber(historyMaxSize) && historyMaxSize >= 0) { this.historyMaxSize = historyMaxSize } const limit = this.historyMaxSize this.messagesHistory = this.messagesHistory.slice(0, limit) this.messagesTimestamps = this.messagesTimestamps.slice(0, limit) this.messagesIds = this.messagesIds.slice(0, limit) return Promise.resolve() }
function validateLimitProperty(clientQuery, meta, actionName) { if (meta.hasLimitProperty && !_.isNumber(request.data.limit)) { return `BadRequest: ${actionName} expected request.data.limit to be a number`; } return undefined; }
(function p(x) { if (_.isArray(x)) _.each(x, p) else if (_.isObject(x)) _.forIn(x, p) else if (_.isNumber(x)) t += x return t })(JSON.parse(i))
_valueForArray(array) { return array.reduce((result, current) => { if (_.isString(current) || _.isNumber(current) || _.isNull(current)) { return result + `${(result === '') ? '' : ','} ${this._valueOnQuery(current)} `; } return result; }, ''); }
it('can get gas estimate for transaction', async function() { const c = new FlexContract(ABI, {provider: provider, bytecode: BYTECODE}); await c.new(123).send(); const r = await c.transact().gas(); assert.ok(_.isNumber(r) && r > 0); });
parseNumber(value) { if (_.isNumber(value)) { return value; } if (s.isBlank(value)) { return 0; } value = value.replace(/\./g, ''); value = value.replace(/,/, '.'); return parseFloat(value); }
function toHex(v) { if (_.isNumber(v)) return '0x'+(new ethjs.BN(v).toString(16)); if (_.isString(v)) { if (v.startsWith('0x')) return v.toLowerCase(); return '0x'+(new ethjs.BN(v).toString(16)); } if (_.isBuffer(v) || _.isArrayLike(v)) return ethjs.bufferToHex(v); throw new Error(`Can't convert value to hex: ${v}`); }
var findApplication = function(applicationName) { var application; if (!_.isNumber(applicationName)) { application = dictionary.getApplicationByName(applicationName); } else { application = dictionary.getApplicationById(applicationName); } return application; }
(function p(x) { if (_.isArray(x)) _.each(x, p) else if (_.isObject(x) && _.every(x, i => i !== 'red')) _.forIn(x, p) else if (_.isNumber(x)) t += x return t })(JSON.parse(i))
/** * isPrimitive * * Returns true if the value is a String, Number or Boolean * otherwise false. * * @param value {Any} Specifies the value to check for a primitive value * @return {Boolean} True/False weather it's a primitive value or not. */ isPrimitive(value) { // for SQL > NULL will also be a leagal primitive value return (value === null || _.isDate(value) || _.isString(value) || _.isNumber(value) || _.isBoolean(value)); }
var findCommand = function(commandName) { var command; if (!_.isNumber(commandName)) { command = dictionary.getCommandByName(commandName); } else { command = dictionary.getCommandByCode(commandName); } return command; }
/** * [timeout set request time out] * @param {[type]} v [timeout ms] * @return {[type]} [description] */ set timeout(v) { /* istanbul ignore else */ if (_.isNumber(v)) { internal(this).timeout = v; } }