notepack.io
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -54,3 +54,3 @@ 'use strict'; | ||
function _encode(bytes, defers, value) { | ||
var type = typeof value, hi = 0, lo = 0, length = 0, size = 0; | ||
var type = typeof value, i = 0, l = 0, hi = 0, lo = 0, length = 0, size = 0; | ||
@@ -219,6 +219,10 @@ if (type === 'string') { | ||
if (typeof value.toJSON === 'function') { | ||
return _encode(bytes, defers, value.toJSON()); | ||
} | ||
var keys = [], key = ''; | ||
var allKeys = Object.keys(value); | ||
for (var i = 0, l = allKeys.length; i < l; i++) { | ||
for (i = 0, l = allKeys.length; i < l; i++) { | ||
key = allKeys[i]; | ||
@@ -249,3 +253,3 @@ if (typeof value[key] !== 'function') { | ||
for (var i = 0; i < length; i++) { | ||
for (i = 0; i < length; i++) { | ||
key = keys[i]; | ||
@@ -252,0 +256,0 @@ size += _encode(bytes, defers, key); |
2.1.0 / 2017-07-31 | ||
=================== | ||
* feat(*): add support for toJSON method (#8) | ||
2.0.1 / 2017-06-06 | ||
@@ -3,0 +8,0 @@ =================== |
@@ -57,3 +57,3 @@ 'use strict'; | ||
function _encode(bytes, defers, value) { | ||
var type = typeof value, hi = 0, lo = 0, length = 0, size = 0; | ||
var type = typeof value, i = 0, l = 0, hi = 0, lo = 0, length = 0, size = 0; | ||
@@ -251,6 +251,10 @@ if (type === 'string') { | ||
if (typeof value.toJSON === 'function') { | ||
return _encode(bytes, defers, value.toJSON()); | ||
} | ||
var keys = [], key = ''; | ||
var allKeys = Object.keys(value); | ||
for (var i = 0, l = allKeys.length; i < l; i++) { | ||
for (i = 0, l = allKeys.length; i < l; i++) { | ||
key = allKeys[i]; | ||
@@ -281,3 +285,3 @@ if (typeof value[key] !== 'function') { | ||
for (var i = 0; i < length; i++) { | ||
for (i = 0; i < length; i++) { | ||
key = keys[i]; | ||
@@ -284,0 +288,0 @@ size += _encode(bytes, defers, key); |
{ | ||
"name": "notepack.io", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "A fast Node.js implementation of the latest MessagePack spec", | ||
@@ -12,3 +12,3 @@ "main": "lib/index.js", | ||
"type": "git", | ||
"url": "https://github.com/coinative/notepack.git" | ||
"url": "https://github.com/darrachequesne/notepack.git" | ||
}, | ||
@@ -18,3 +18,3 @@ "author": "Ben Shepheard <ben@coinative.com>", | ||
"bugs": { | ||
"url": "https://github.com/coinative/notepack/issues" | ||
"url": "https://github.com/darrachequesne/notepack/issues" | ||
}, | ||
@@ -27,2 +27,3 @@ "homepage": "https://github.com/coinative/notepack", | ||
"istanbul": "^0.4.5", | ||
"jshint": "^2.9.5", | ||
"mocha": "^3.2.0", | ||
@@ -34,6 +35,5 @@ "msgpack-js": "^0.3.0", | ||
"scripts": { | ||
"test": "./node_modules/.bin/mocha -r ./test/support/env -R dot ./test", | ||
"test-cov": "./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha -- -r ./test/support/env -R dot ./test", | ||
"test-travis": "./node_modules/.bin/istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -r ./test/support/env -R spec ./test", | ||
"build": "rm -rf dist && ./node_modules/.bin/webpack --config support/webpack.config.js" | ||
"test": "npm run lint && istanbul cover _mocha -r test/support/env test/", | ||
"build": "rm -rf dist && webpack --config support/webpack.config.js", | ||
"lint": "jshint lib/*.js browser/*.js test/*.js" | ||
}, | ||
@@ -40,0 +40,0 @@ "browser": { |
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
36830
1103
9