Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jpacks

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jpacks - npm Package Compare versions

Comparing version 0.7.2 to 0.8.1

27

jpacks.dev.js

@@ -8,4 +8,4 @@ (function (exportName) {

* zswang (http://weibo.com/zswang)
* @version 0.7.2
* @date 2016-08-01
* @version 0.8.1
* @date 2016-08-27
*/

@@ -170,2 +170,9 @@ function createSchema() {

```
* @example arrayBufferFrom():string Unicode
```js
var _ = jpacks;
var ab = _.arrayBufferFrom('汉字');
console.log(new Buffer(new Uint8Array(ab)).toString('hex'));
// > e6b189e5ad97
```
'''</example>'''

@@ -1174,3 +1181,3 @@ */

// > 228 189 160 229 165 189 228 184 150 231 149 140 239 188 129 72 101 108 108 111
'''<example>'''
'''</example>'''
*/

@@ -1180,3 +1187,3 @@ function stringBytes(value, options) {

if (!options.browser && typeof Buffer !== 'undefined') { // NodeJS
return new Buffer(value, options.encoding || 'binary');
return new Buffer(value, options.encoding || 'utf8');
} else {

@@ -1218,3 +1225,3 @@ if (typeof TextEncoder === 'function') {

// > 你好世界!Hello
'''<example>'''
'''</example>'''
*/

@@ -1257,3 +1264,3 @@ function stringCreator(size) {

console.log(_.stringify(_schema));
// > string(uint8)
// > string('uint8')
var buffer = _.pack(_schema, 'shortString');

@@ -1278,6 +1285,6 @@ console.log(buffer.join(' '));

console.log(_.stringify(_schema));
// > string(uint16)
// > string('uint16')
var buffer = _.pack(_schema, 'smallString');
console.log(buffer.join(' '));
// > 0 11 115 109 97 108 108 83 116 114 105 110 103
// > 11 0 115 109 97 108 108 83 116 114 105 110 103
console.log(_.unpack(_schema, buffer));

@@ -1299,6 +1306,6 @@ // > smallString

console.log(_.stringify(_schema));
// > string(uint32)
// > string('uint32')
var buffer = _.pack(_schema, 'longString');
console.log(buffer.join(' '));
// > 0 0 0 10 108 111 110 103 83 116 114 105 110 103
// > 10 0 0 0 108 111 110 103 83 116 114 105 110 103
console.log(_.unpack(_schema, buffer));

@@ -1305,0 +1312,0 @@ // > longString

@@ -8,4 +8,4 @@ (function (exportName) {

* zswang (http://weibo.com/zswang)
* @version 0.7.2
* @date 2016-08-02
* @version 0.8.1
* @date 2016-08-27
*/

@@ -155,2 +155,9 @@ function createSchema() {

```
* @example arrayBufferFrom():string Unicode
```js
var _ = jpacks;
var ab = _.arrayBufferFrom('汉字');
console.log(new Buffer(new Uint8Array(ab)).toString('hex'));
// > e6b189e5ad97
```
'''</example>'''

@@ -1111,3 +1118,3 @@ */

// > 228 189 160 229 165 189 228 184 150 231 149 140 239 188 129 72 101 108 108 111
'''<example>'''
'''</example>'''
*/

@@ -1117,3 +1124,3 @@ function stringBytes(value, options) {

if (!options.browser && typeof Buffer !== 'undefined') { // NodeJS
return new Buffer(value, options.encoding || 'binary');
return new Buffer(value, options.encoding || 'utf8');
} else {

@@ -1155,3 +1162,3 @@ if (typeof TextEncoder === 'function') {

// > 你好世界!Hello
'''<example>'''
'''</example>'''
*/

@@ -1194,3 +1201,3 @@ function stringCreator(size) {

console.log(_.stringify(_schema));
// > string(uint8)
// > string('uint8')
var buffer = _.pack(_schema, 'shortString');

@@ -1215,6 +1222,6 @@ console.log(buffer.join(' '));

console.log(_.stringify(_schema));
// > string(uint16)
// > string('uint16')
var buffer = _.pack(_schema, 'smallString');
console.log(buffer.join(' '));
// > 0 11 115 109 97 108 108 83 116 114 105 110 103
// > 11 0 115 109 97 108 108 83 116 114 105 110 103
console.log(_.unpack(_schema, buffer));

@@ -1236,6 +1243,6 @@ // > smallString

console.log(_.stringify(_schema));
// > string(uint32)
// > string('uint32')
var buffer = _.pack(_schema, 'longString');
console.log(buffer.join(' '));
// > 0 0 0 10 108 111 110 103 83 116 114 105 110 103
// > 10 0 0 0 108 111 110 103 83 116 114 105 110 103
console.log(_.unpack(_schema, buffer));

@@ -1242,0 +1249,0 @@ // > longString

@@ -5,3 +5,3 @@ {

"description": "Binary data packing and unpacking.",
"version": "0.7.2",
"version": "0.8.1",
"homepage": "http://github.com/zswang/jpacks",

@@ -35,4 +35,4 @@ "main": "jpacks.js",

"dependencies": {
"protobufjs": "^4.1.2",
"long": "^3.0.1"
"long": "^3.0.1",
"protobufjs": "^4.1.2"
},

@@ -46,2 +46,3 @@ "devDependencies": {

"jshint": "^2.8.0",
"examplejs": "^0.1.18",
"jstrs": "^0.0.1"

@@ -54,3 +55,3 @@ },

"_compress": "uglifyjs jpacks.js -o jpacks.min.js -p 5 -c -m",
"example": "jdists example.jdists.js -o test/example.js",
"example": "examplejs src/**/*.js -o test/example.js -h example.inc.js && examplejs schemas-extend/**/*.js -o test/schemas-extend.js -h example.inc.js",
"test": "istanbul cover --hook-run-in-context node_modules/mocha/bin/_mocha -- -R spec",

@@ -57,0 +58,0 @@ "mocha": "jdists example.jdists.js -o test/example.js && mocha",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc