How to use the number function from assert-plus
Find comprehensive JavaScript assert-plus.number code examples handpicked from public code repositorys.
3302 3303 3304 3305 3306 3307 3308 3309 3310 3311
break; case UPLOAD_OPS.GET: finalURL = location + '/state'; break; case UPLOAD_OPS.UPLOAD: assert.number(uu.uu_partNum, 'partNum'); finalURL = location + '/' + uu.uu_partNum; break; default: throw (new Verror('Invalid operation: %s', uu.uu_op));
41
75
0
80 81 82 83 84 85 86 87 88 89 90 91 92
} function zeroPad(n, width) { var s = String(n); assert.number(width, 'width'); assert.string(s, 'string'); while (s.length < width) { s = '0' + s;
38
55
41
+ 7 other calls in file
603 604 605 606 607 608 609 610 611 612
* @param {Function} callback of the form f(err, vlan, res). */ CloudApi.prototype.createFabricNetwork = function createFabricNetwork(opts, cb) { assert.object(opts, 'opts'); assert.number(opts.vlan_id, 'opts.vlan_id'); assert.string(opts.name, 'opts.name'); assert.string(opts.subnet, 'opts.subnet'); assert.string(opts.provision_start_ip, 'opts.provision_start_ip'); assert.string(opts.provision_end_ip, 'opts.provision_end_ip');
38
55
0
+ 76 other calls in file
GitHub: TritonDataCenter/moray
124 125 126 127 128 129 130 131 132 133 134
function PGClient(options) { assert.object(options, 'options'); assert.object(options.client, 'options.client'); assert.object(options.log, 'options.log'); assert.object(options.pool, 'options.pool'); assert.number(options.queryTimeout, 'options.queryTimeout'); if (++CLIENT_ID >= 4294967295) { // 2^32 -1 CLIENT_ID = 1; }
21
60
0
+ 15 other calls in file
2564 2565 2566 2567 2568 2569 2570 2571 2572 2573
assert.object(ctx, 'ctx'); assert.string(ctx.filePath, 'ctx.filePath'); assert.string(ctx.dsName, 'ctx.dsName'); assert.string(ctx.zpool, 'ctx.zpool'); assert.object(ctx.imgMeta.manifest, 'ctx.imgMeta.manifest'); assert.number(ctx.imgMeta.size, 'ctx.imgMeta.size'); assert.optionalBool(ctx.zstream, 'ctx.zstream'); assert.optionalBool(ctx.quiet, 'ctx.quiet'); var zstream = Boolean(ctx.zstream);
248
0
0
1922 1923 1924 1925 1926 1927 1928 1929 1930 1931
* function (err, res) { }); */ RegistryClientV2.prototype.blobUpload = function blobUpload(opts, cb) { var self = this; assert.object(opts, 'opts'); assert.number(opts.contentLength, 'opts.contentLength'); assert.string(opts.digest, 'opts.digest'); assert.object(opts.stream, 'opts.stream'); assert.optionalString(opts.contentType, 'opts.contentType'); assert.optionalObject(opts.log, 'opts.log');
35
59
0
GitHub: TritonDataCenter/sdcadm
436 437 438 439 440 441 442 443 444 445
// storage. Each volume size is represented by a different package used // when provisioning these storage VMs. Thus these packages need to be // added into PAPI before any NFS shared volume can be created. function addSharedVolumesPackages(ctx, next) { function createPackageSettings(packageSize) { assert.number(packageSize, 'packageSize'); assert.ok(packageSize > 0); return { size: packageSize,
19
13
0
+ 3 other calls in file
498 499 500 501 502 503 504 505 506 507
filter.push(sprintf(PARAM_FILTER, 'state', params.state)); } } if (params.create_timestamp !== undefined) { assert.number(params.create_timestamp, 'If not undefined, params.create_timestamp must be a number'); filter.push(sprintf(PARAM_FILTER, 'create_timestamp', params.create_timestamp)); }
20
11
0
50 51 52 53 54 55 56 57 58 59 60
function assertObjContent(opts, cb) { assert.object(opts.t, 'opts.t'); assert.object(opts.stream, 'opts.stream'); assert.object(opts.res, 'opts.res'); assert.number(opts.code, 'opts.code'); assert.string(opts.text, 'opts.text'); assert.optionalString(opts.contentType, 'opts.contentType'); assert.func(cb, 'cb');
16
13
0
978 979 980 981 982 983 984 985 986 987 988 989 990
}); } function volumeSizeDescription(pkg) { assert.object(pkg, 'pkg'); assert.number(pkg.quota, 'pkg.quota'); var pkgSizeGiB = Math.floor(pkg.quota / 1024); return pkgSizeGiB + ' GiB';
6
8
0
+ 5 other calls in file
114 115 116 117 118 119 120 121 122 123 124 125
this.name = 'ValidationError'; } util.inherits(ValidationError, restify.RestError); function VolumeSizeNotAvailableError(size, availableSizes) { assert.number(size, 'size'); assert.arrayOfNumber(availableSizes, 'availableSizes'); var message = 'Volume size ' + size + ' is not available. Available ' + 'sizes are: ' + availableSizes.join(', ');
6
8
0
GitHub: TritonDataCenter/sdc-manta
948 949 950 951 952 953 954 955 956 957
var alarmstate = null, alarmIds = null; assertplus.object(args, 'args'); assertplus.object(args, 'args.sources'); assertplus.number(args.concurrency, 'args.concurrency'); assertplus.string(args.configFile, 'args.configFile'); assertplus.func(callback, 'callback'); assertplus.strictEqual(this.ma_alarms, null); assertplus.strictEqual(this.ma_amon_deployed, null);
13
7
42
+ 8 other calls in file
339 340 341 342 343 344 345 346 347 348
} // Ensure our numbers are numbers. mod_assert.number(peerObj.assid, 'peerObj.assid'); mod_assert.number(peerObj.st, 'peerObj.st'); mod_assert.number(peerObj.when, 'peerObj.when'); mod_assert.number(peerObj.poll, 'peerObj.poll'); mod_assert.number(peerObj.delay, 'peerObj.delay'); mod_assert.number(peerObj.offset, 'peerObj.offset'); mod_assert.number(peerObj.jitter, 'peerObj.jitter');
8
3
0
+ 17 other calls in file
20 21 22 23 24 25 26 27 28 29 30 31
function PluginDirLoader(opts) { var self = this; mod_assert.object(opts, 'opts'); mod_assert.number(opts.defaultTimeout, 'opts.defaultTimeout'); mod_assert.number(opts.defaultTTL, 'opts.defaultTTL'); mod_assert.optionalBool(opts.enforceRoot, 'opts.enforceRoot'); mod_assert.object(opts.log, 'opts.log'); self.log = opts.log;
8
3
0
+ 7 other calls in file
1935 1936 1937 1938 1939 1940 1941 1942 1943 1944
var file = options.file; function getFileStreamAndSize(next) { var stream; if (typeof (file) === 'object') { assert.number(options.size, 'options.size'); return next(null, file, options.size); } else if (options.size) { stream = fs.createReadStream(file); pauseStream(stream);
13
2
36
345 346 347 348 349 350 351 352 353 354
* @param {Number} id : The integer alarm id. * @param {Function} callback : callback of the form fn(err, alarm) */ Amon.prototype.getAlarm = function getAlarm(user, id, callback) { assert.string(user, 'user'); assert.number(id, 'id'); if (!/^\d+$/.test(String(id))) { throw new assert.AssertionError({ message: format('id is not a positive integer: %s', id), actual: typeof (id), expected: 'integer', operator: '==='});
13
2
0
+ 3 other calls in file
374 375 376 377 378 379 380 381 382 383
switch (options.type) { case 'object': assert.optionalString(options.contentDisposition, 'options.contentDisposition'); assert.number(options.contentLength, 'options.contentLength'); assert.string(options.contentMD5, 'options.contentMD5'); assert.string(options.contentType, 'options.contentType'); assert.string(options.objectId, 'options.objectId'); assert.arrayOfObject(options.sharks, 'options.sharks');
6
2
0
102 103 104 105 106 107 108 109 110 111
); } if (config.port) { assert.string(config.address, 'config.address'); assert.number(config.port, 'config.port'); } else { assert.equal(undefined, config.address, 'config.address'); assert.string(config.path, 'config.path'); }
3
0
0
27 28 29 30 31 32 33 34 35 36
* @param {number} size - the file's size in bytes * @param {bool} writable - indicates whether the file was opened writable */ constructor(name, fd, size, writable) { assert.string(name, 'name'); assert.number(fd, 'fd'); assert.number(size, 'size'); assert.optionalBool(writable, 'writable'); this[$name] = name; this[$fd] = fd;
2
0
0
+ 5 other calls in file
107 108 109 110 111 112 113 114 115 116 117
function addObjects(morayClient, bucketName, objectTemplate, nbObjects, callback) { assert.object(morayClient, 'morayClient'); assert.string(bucketName, 'bucketName'); assert.object(objectTemplate, 'objectTemplate'); assert.number(nbObjects, 'nbObjects'); assert.func(callback, 'callback'); var totalNbObjectsCreated = 0; var ADD_CONCURRENCY = 100;
0
0
0
assert-plus.object is the most popular function in assert-plus (2295 examples)