Comparing version 4.1.4 to 4.1.5
@@ -9,3 +9,3 @@ 'use strict' | ||
const constants = require('./constants') | ||
const bignumber = require('bignumber.js') | ||
const bignumber = require('bignumber.js').BigNumber | ||
const NoFilter = require('nofilter') | ||
@@ -12,0 +12,0 @@ |
@@ -7,3 +7,3 @@ 'use strict' | ||
const utils = require('./utils') | ||
const bignumber = require('bignumber.js') | ||
const bignumber = require('bignumber.js').BigNumber | ||
const NoFilter = require('nofilter') | ||
@@ -10,0 +10,0 @@ const constants = require('./constants') |
@@ -9,3 +9,3 @@ 'use strict' | ||
const constants = require('./constants') | ||
const bignumber = require('bignumber.js') | ||
const bignumber = require('bignumber.js').BigNumber | ||
const NoFilter = require('nofilter') | ||
@@ -65,3 +65,5 @@ | ||
if (this.stream_errors) { | ||
this._on_error(er) | ||
if (er) { | ||
this._on_error(er) | ||
} | ||
return cb() | ||
@@ -68,0 +70,0 @@ } else { |
@@ -5,3 +5,3 @@ 'use strict' | ||
const url = require('url') | ||
const bignumber = require('bignumber.js') | ||
const bignumber = require('bignumber.js').BigNumber | ||
const NoFilter = require('nofilter') | ||
@@ -60,2 +60,13 @@ const Tagged = require('./tagged') | ||
* fractional seconds. | ||
* @param {any} [options.encodeUndefined=undefined] - How should an | ||
* "undefined" in the input be encoded. By default, just encode a CBOR | ||
* undefined. If this is a buffer, use those bytes without re-encoding | ||
* them. If this is a function, the function will be called (which is | ||
* a good time to throw an exception, if that's what you want), and the | ||
* return value will be used according to these rules. Anything | ||
* else will be encoded as CBOR. | ||
* @param {boolean} [options.disallowUndefinedKeys=false] - Should "undefined" | ||
* be disallowed as a key in a Map that is serialized? If this is true, | ||
* encode(new Map([[undefined, 1]])) will throw an exception. Note that | ||
* it is impossible to get a key of undefined in a normal JS object. | ||
*/ | ||
@@ -69,2 +80,4 @@ constructor(options) { | ||
this.canonical = options.canonical | ||
this.encodeUndefined = options.encodeUndefined | ||
this.disallowUndefinedKeys = !!options.disallowUndefinedKeys | ||
this.dateType = (options.dateType != null) ? | ||
@@ -269,3 +282,13 @@ options.dateType.toLowerCase() : 'number' | ||
_pushUndefined(obj) { | ||
return this._pushUInt8(UNDEFINED) | ||
switch (typeof this.encodeUndefined) { | ||
case 'undefined': | ||
return this._pushUInt8(UNDEFINED) | ||
case 'function': | ||
return this.pushAny(this.encodeUndefined.call(this, obj)) | ||
case 'object': | ||
if (Buffer.isBuffer(this.encodeUndefined)) { | ||
return this.push(this.encodeUndefined) | ||
} | ||
} | ||
return this.pushAny(this.encodeUndefined) | ||
} | ||
@@ -413,4 +436,7 @@ | ||
}) | ||
for (const kv of entries) { | ||
if (!(gen.pushAny(kv[0]) && gen.pushAny(kv[1]))) { | ||
for (const [k, v] of entries) { | ||
if (gen.disallowUndefinedKeys && (typeof k === 'undefined')) { | ||
throw new Error('Invalid Map key: undefined') | ||
} | ||
if (!(gen.pushAny(k) && gen.pushAny(v))) { | ||
return false | ||
@@ -420,4 +446,7 @@ } | ||
} else { | ||
for (const kv of obj) { | ||
if (!(gen.pushAny(kv[0]) && gen.pushAny(kv[1]))) { | ||
for (const [k, v] of obj) { | ||
if (gen.disallowUndefinedKeys && (typeof k === 'undefined')) { | ||
throw new Error('Invalid Map key: undefined') | ||
} | ||
if (!(gen.pushAny(k) && gen.pushAny(v))) { | ||
return false | ||
@@ -424,0 +453,0 @@ } |
'use strict' | ||
const bignumber = require('bignumber.js') | ||
const bignumber = require('bignumber.js').BigNumber | ||
const utils = require('./utils') | ||
@@ -5,0 +5,0 @@ const url = require('url') |
@@ -5,3 +5,3 @@ 'use strict' | ||
const stream = require('stream') | ||
const bignumber = require('bignumber.js') | ||
const bignumber = require('bignumber.js').BigNumber | ||
@@ -231,5 +231,5 @@ const constants = require('./constants') | ||
function printError(er) { | ||
exports.printError = function printError(er) { | ||
if (er != null) { | ||
return console.log(er) | ||
return console.error(er) | ||
} | ||
@@ -239,5 +239,2 @@ } | ||
exports.streamFiles = function streamFiles(files, streamFunc, cb) { | ||
if (cb == null) { | ||
cb = printError | ||
} | ||
const f = files.shift() | ||
@@ -244,0 +241,0 @@ if (!f) { |
{ | ||
"name": "cbor", | ||
"version": "4.1.4", | ||
"version": "4.1.5", | ||
"description": "Encode and parse data in the Concise Binary Object Representation (CBOR) data format (RFC7049).", | ||
@@ -62,3 +62,3 @@ "main": "./lib/cbor.js", | ||
"devDependencies": { | ||
"ava": "^1.0.1", | ||
"ava": "^1.2.0", | ||
"concordance": "^4.0", | ||
@@ -70,2 +70,3 @@ "garbage": "0.0", | ||
"minami": "*", | ||
"mock-stdio": "^1.0.3", | ||
"npm-run-all": "^4.1.5", | ||
@@ -78,3 +79,3 @@ "nyc": "^13.1.0", | ||
"dependencies": { | ||
"bignumber.js": "^8.0.1", | ||
"bignumber.js": "^8.0.2", | ||
"commander": "^2.19.0", | ||
@@ -81,0 +82,0 @@ "json-text-sequence": "^0.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
86158
11
25
2375
Updatedbignumber.js@^8.0.2