Comparing version 0.8.0 to 1.0.0
{ | ||
"name": "bytewise", | ||
"version": "0.8.0", | ||
"version": "1.0.0", | ||
"description": "Binary serialization which sorts bytewise for arbirarily complex data structures", | ||
"main": "bytewise.js", | ||
"dependencies": { | ||
"bops": "~0.1.0" | ||
}, | ||
"devDependencies": { | ||
"tape": "~1.0", | ||
"typewise": "~0.7" | ||
}, | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "tape test", | ||
"bench": "node bench" | ||
"test": "tape test | faucet" | ||
}, | ||
@@ -23,6 +15,6 @@ "repository": { | ||
"binary", | ||
"sort", | ||
"collation", | ||
"serialization", | ||
"leveldb", | ||
"couchdb", | ||
"indexeddb" | ||
@@ -32,22 +24,17 @@ ], | ||
"license": "MIT", | ||
"readmeFilename": "README.md", | ||
"bugs": { | ||
"url": "https://github.com/deanlandolt/bytewise/issues" | ||
}, | ||
"homepage": "https://github.com/deanlandolt/bytewise", | ||
"browser": { | ||
"typewise": false | ||
}, | ||
"testling": { | ||
"files": "test/*.js", | ||
"browsers": [ | ||
"ie/8..latest", | ||
"firefox/17..latest", | ||
"firefox/nightly", | ||
"chrome/22..latest", | ||
"chrome/canary", | ||
"opera/12..latest", | ||
"opera/next", | ||
"safari/5.1..latest", | ||
"ipad/6.0..latest", | ||
"iphone/6.0..latest", | ||
"android-browser/4.2..latest" | ||
] | ||
"dependencies": { | ||
"bytewise-core": "^1.1", | ||
"typewise": "^1.0" | ||
}, | ||
"devDependencies": { | ||
"faucet": "0.0.1", | ||
"tape": "^1.0" | ||
} | ||
} |
@@ -21,10 +21,5 @@ bytewise | ||
* `Date` (numeric, epoch offset) | ||
* `Buffer`, `Uint8Array` (bitwise) | ||
* `Buffer` (bitwise) | ||
* `String` (lexicographic) | ||
* `Set` (componentwise with elements sorted) | ||
* `Array` (componentwise) | ||
* `Object` (componentwise string-keyed key/value pairs) | ||
* `Map` (componentwise key/value pairs) | ||
* `RegExp` (stringified lexicographic) | ||
* `Function` (stringified lexicographic) | ||
* `undefined` | ||
@@ -35,3 +30,3 @@ | ||
For example, negative numbers are stored as a different *type* from positive numbers, with its sign bit stripped and its bytes inverted to ensure numbers with a larger magnitude come first. `Infinity` and `-Infinity` can also be encoded -- they are *nullary* types, encoded using just their type tag. The same can be said of `null` and `undefined`, and the boolean values `false`, `true`. `Date` instances are stored just like `Number` instances -- but as in IndexedDB -- `Date` sorts after `Number` (including `Infinity`). `Buffer` data can be stored in the raw, and is sorted before `String` data. Then come the collection types -- `Array` and `Object`, along with the additional types defined by es6: `Map` and `Set`. We can even serialize `Function` values and (with the optional `typewise` dependency) revive them in an isolated [Secure ECMAScript](https://code.google.com/p/es-lab/wiki/SecureEcmaScript) context where they are powerless to do anything but calculate. | ||
For example, negative numbers are stored as a different *type* from positive numbers, with its sign bit stripped and its bytes inverted to ensure numbers with a larger magnitude come first. `Infinity` and `-Infinity` can also be encoded -- they are *nullary* types, encoded using just their type tag. The same can be said of `null` and `undefined`, and the boolean values `false`, `true`. `Date` instances are stored just like `Number` instances -- but as in IndexedDB -- `Date` sorts after `Number` (including `Infinity`). `Buffer` data can be stored in the raw, and is sorted before `String` data. Then come the collection types (just `Array` for the time being). | ||
@@ -41,3 +36,3 @@ | ||
This serialization accommodates a wide range of javascript structures, but it is not exhaustive. Objects or arrays with reference cycles cannot be serialized. `NaN` is also illegal anywhere in a serialized value -- its presence very likely indicates of an error, but more importantly sorting on `NaN` is nonsensical by definition. (Similarly we may want to reject objects which are instances of `Error`.) Invalid `Date` objects are also illegal. Since `WeakMap` and `WeakSet` objects cannot be enumerated they are impossible to serialize. Attempts to serialize any values which include these structures should throw a `TypeError`. | ||
This serialization accommodates a wide range of javascript structures, but it is not exhaustive. Complex structures with reference cycles cannot be serialized. `NaN` is also illegal anywhere in a serialized value -- its presence very likely indicates of an error, but more importantly sorting on `NaN` is nonsensical by definition. Objects which are instances of `Error` are also rejected, as well as `Invalid Date` objects. If and when we support more complex collection types, `WeakMap` and `WeakSet` objects will never be serializable as they cannot be enumerated. Attempts to serialize any values which include these structures will throw an error. | ||
@@ -108,3 +103,4 @@ | ||
// Objects are just string-keyed maps, stored like arrays: [ k1, v1, k2, v2, ... ] | ||
assert.equal(encode({ foo: true, bar: 'baz' }).toString('binary'), '\xb0pfoo\x00\x21\pbar\x00\pbaz\x00\x00'); | ||
// NYI in this version | ||
// assert.equal(encode({ foo: true, bar: 'baz' }).toString('binary'), '\xb0pfoo\x00\x21\pbar\x00\pbaz\x00\x00'); | ||
@@ -149,3 +145,3 @@ ``` | ||
42, | ||
new Date('2000-01-01T00:00:00Z'), | ||
new Date('2000-01-01Z'), | ||
'', | ||
@@ -178,3 +174,3 @@ 'foo √', | ||
It may be reasonably fast to encode and decode, but `JSON.stringify` is totally useless for storing objects as document records in a way that is of any use for range queries, where LevelDB and its ilk excel. This serialization allows you to build indexes on top of your documents, as well as expanding on the range of serializable types available in JSON. | ||
It may be reasonably fast to encode and decode, but `JSON.stringify` isn't terribly useful or objects as document records in a way that is useful for range queries, where LevelDB and its ilk excel. This serialization allows you to build indexes on top of your documents, as well as expanding on the range of serializable types available from JSON. | ||
@@ -191,3 +187,3 @@ ### Multilevel language-sensitive collation | ||
Build a view that colocates related subrecords, taking advantage of component-wise sorting of arrays to interleave them. This is a technique I first saw [employed by CouchDB](http://www.cmlenz.net/archives/2007/10/couchdb-joins). More recently [Akiban](http://www.akiban.com/) has formalized this concept of [table grouping](http://blog.akiban.com/how-does-table-grouping-compare-to-sql-server-indexed-views/) and brought it the SQL world. Our collation extends naturally to their idea of [hierarchical keys](http://blog.akiban.com/introducing-hkey/). | ||
Build a view that colocates related subrecords, taking advantage of component-wise sorting of arrays to interleave them. This is a technique [employed by CouchDB](http://www.cmlenz.net/archives/2007/10/couchdb-joins), leveraging its very similar collation semantics to keep related grouped together hierarchically. More recently [Akiban](http://www.akiban.com/) has formalized this concept of a [table grouping](http://blog.akiban.com/how-does-table-grouping-compare-to-sql-server-indexed-views/) and brought it the SQL world. Again, bytewise sorting extends naturally to their notions of [hierarchical keys](http://blog.akiban.com/introducing-hkey/). | ||
@@ -194,0 +190,0 @@ ### Emulating other systems |
@@ -1,8 +0,4 @@ | ||
// Find and require all test modules | ||
require('../') | ||
var fs = require('fs'); | ||
fs.readdirSync(__dirname).filter(function(filename) { | ||
return filename.match(/\.js$/) && filename != 'index.js'; | ||
}).forEach(function(filename) { | ||
require('./' + filename); | ||
}); | ||
// require('typewise/test/') | ||
require('bytewise-core/test/') |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
1
0
0
13335
2
7
10
191
2
+ Addedbytewise-core@^1.1
+ Addedtypewise@^1.0
+ Addedbytewise-core@1.2.3(transitive)
+ Addedtypewise@1.0.3(transitive)
+ Addedtypewise-core@1.2.0(transitive)
- Removedbops@~0.1.0
- Removedbase64-js@0.0.2(transitive)
- Removedbops@0.1.1(transitive)
- Removedto-utf8@0.0.1(transitive)