Comparing version 2.0.0 to 2.0.1
@@ -0,1 +1,11 @@ | ||
<a name="2.0.1"></a> | ||
## [2.0.1](https://github.com/dignifiedquire/borc/compare/v2.0.0...v2.0.1) (2016-12-14) | ||
### Bug Fixes | ||
* **decoder:** handle large input sizes ([b44cdfe](https://github.com/dignifiedquire/borc/commit/b44cdfe)), closes [#10](https://github.com/dignifiedquire/borc/issues/10) | ||
<a name="2.0.0"></a> | ||
@@ -2,0 +12,0 @@ # [2.0.0](https://github.com/dignifiedquire/borc/compare/v2.0.2...v2.0.0) (2016-12-11) |
{ | ||
"name": "borc", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Encode and parse data in the Concise Binary Object Representation (CBOR) data format (RFC7049).", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
@@ -6,9 +6,9 @@ # borc | ||
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) | ||
[![Coverage Status](https://coveralls.io/repos/github/dignifiedquire/borc/badge.svg?branch=master)](https://coveralls.io/github/dignifiedquire/fast-cbor?branch=master) | ||
[![Dependency Status](https://david-dm.org/dignifiedquire/borc.svg?style=flat-square)](https://david-dm.org/dignifiedquire/fast-cbor) | ||
[![Travis CI](https://travis-ci.org/dignifiedquire/borc.svg?branch=master)](https://travis-ci.org/dignifiedquire/fast-cbor) | ||
[![Circle CI](https://circleci.com/gh/dignifiedquire/borc.svg?style=svg)](https://circleci.com/gh/dignifiedquire/fast-cbor) | ||
[![Coverage Status](https://coveralls.io/repos/github/dignifiedquire/borc/badge.svg?branch=master)](https://coveralls.io/github/dignifiedquire/borc?branch=master) | ||
[![Dependency Status](https://david-dm.org/dignifiedquire/borc.svg?style=flat-square)](https://david-dm.org/dignifiedquire/borc) | ||
[![Travis CI](https://travis-ci.org/dignifiedquire/borc.svg?branch=master)](https://travis-ci.org/dignifiedquire/borc) | ||
[![Circle CI](https://circleci.com/gh/dignifiedquire/borc.svg?style=svg)](https://circleci.com/gh/dignifiedquire/borc) | ||
> Encode and parse data in the Concise Binary Object Representation (CBOR) data format ([RFC7049](http://tools.ietf.org/html/rfc7049)) **as fast as possible**. | ||
> Assimilate all your JavaScript objects into the Concise Binary Object Representation (CBOR) data format ([RFC7049](http://tools.ietf.org/html/rfc7049)) **as fast as possible**. | ||
@@ -18,4 +18,3 @@ | ||
This library is a fork of the awesome [node-cbor]([![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) | ||
). It borrows a lot of the interface, but drops all streaming and async processing in favor of a minimal syn api and being as fast as possible. | ||
This library is a fork of the awesome [node-cbor](https://github.com/hildjj/node-cbor). It borrows a lot of the interface, but drops all streaming and async processing in favor of a minimal syn api and being as fast as possible. | ||
@@ -22,0 +21,0 @@ |
@@ -26,2 +26,5 @@ 'use strict' | ||
opts.size = 0x10000 | ||
} else { | ||
// Ensure the size is a power of 2 | ||
opts.size = utils.nextPowerOf2(opts.size) | ||
} | ||
@@ -597,3 +600,3 @@ | ||
const dec = new Decoder() | ||
const dec = new Decoder({size: input.length}) | ||
return dec.decodeFirst(input) | ||
@@ -614,3 +617,3 @@ } | ||
const dec = new Decoder() | ||
const dec = new Decoder({size: input.length}) | ||
return dec.decodeAll(input) | ||
@@ -617,0 +620,0 @@ } |
@@ -158,1 +158,17 @@ 'use strict' | ||
} | ||
exports.nextPowerOf2 = (n) => { | ||
let count = 0 | ||
// First n in the below condition is for | ||
// the case where n is 0 | ||
if (n && !(n & (n - 1))) { | ||
return n | ||
} | ||
while (n !== 0) { | ||
n >>= 1 | ||
count += 1 | ||
} | ||
return 1 << count | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
793843
11035
88