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

jpacks

Package Overview
Dependencies
Maintainers
1
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.8.2 to 0.8.6

schemas-extend/leb128.js

35

jpacks.dev.js

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

* zswang (http://weibo.com/zswang)
* @version 0.8.2
* @date 2016-09-13
* @version 0.8.6
* @date 2017-06-14
*/

@@ -1176,2 +1176,3 @@ function createSchema() {

* @example stringBytes():base
```js
var _ = jpacks;

@@ -1181,2 +1182,18 @@ var buffer = _.pack(_.bytes(20), _.stringBytes('你好世界!Hello'));

// > 228 189 160 229 165 189 228 184 150 231 149 140 239 188 129 72 101 108 108 111
```
* @example stringBytes():coverage
```js
var _ = jpacks;
function TextEncoder() {}
TextEncoder.prototype.encode = function (value) {
return new Buffer(value);
};
global.TextEncoder = TextEncoder;
var buffer = _.pack(_.bytes(20), _.stringBytes('你好世界!Hello'));
setTimeout(function () {
delete global.TextEncoder;
}, 0);
console.log(buffer.join(' '));
// > 228 189 160 229 165 189 228 184 150 231 149 140 239 188 129 72 101 108 108 111
```
'''</example>'''

@@ -1205,2 +1222,3 @@ */

* @example stringCreator():static
```js
var _ = jpacks;

@@ -1213,5 +1231,7 @@ var _schema = _.string(25);

// > 228 189 160 229 165 189 228 184 150 231 149 140 239 188 129 72 101 108 108 111 0 0 0 0 0
console.log(_.unpack(_schema, buffer));
// > 你好世界!Hello
console.log(JSON.stringify(_.unpack(_schema, buffer)));
// > "你好世界!Hello\u0000\u0000\u0000\u0000\u0000"
```
* @example stringCreator():dynamic
```js
var _ = jpacks;

@@ -1226,6 +1246,11 @@ var _schema = _.string('int8');

// > 你好世界!Hello
```
* @example stringCreator():coverage
```js
var _ = jpacks;
_.string();
```
'''</example>'''
*/
function stringCreator(size) {
// console.log('stringCreator', Schema.stringify(size));
var schema = Schema.array('uint8', size);

@@ -1232,0 +1257,0 @@ return new Schema({

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

* zswang (http://weibo.com/zswang)
* @version 0.8.2
* @date 2016-09-13
* @version 0.8.6
* @date 2017-06-14
*/

@@ -1113,2 +1113,3 @@ function createSchema() {

* @example stringBytes():base
```js
var _ = jpacks;

@@ -1118,2 +1119,18 @@ var buffer = _.pack(_.bytes(20), _.stringBytes('你好世界!Hello'));

// > 228 189 160 229 165 189 228 184 150 231 149 140 239 188 129 72 101 108 108 111
```
* @example stringBytes():coverage
```js
var _ = jpacks;
function TextEncoder() {}
TextEncoder.prototype.encode = function (value) {
return new Buffer(value);
};
global.TextEncoder = TextEncoder;
var buffer = _.pack(_.bytes(20), _.stringBytes('你好世界!Hello'));
setTimeout(function () {
delete global.TextEncoder;
}, 0);
console.log(buffer.join(' '));
// > 228 189 160 229 165 189 228 184 150 231 149 140 239 188 129 72 101 108 108 111
```
'''</example>'''

@@ -1142,2 +1159,3 @@ */

* @example stringCreator():static
```js
var _ = jpacks;

@@ -1150,5 +1168,7 @@ var _schema = _.string(25);

// > 228 189 160 229 165 189 228 184 150 231 149 140 239 188 129 72 101 108 108 111 0 0 0 0 0
console.log(_.unpack(_schema, buffer));
// > 你好世界!Hello
console.log(JSON.stringify(_.unpack(_schema, buffer)));
// > "你好世界!Hello\u0000\u0000\u0000\u0000\u0000"
```
* @example stringCreator():dynamic
```js
var _ = jpacks;

@@ -1163,6 +1183,11 @@ var _schema = _.string('int8');

// > 你好世界!Hello
```
* @example stringCreator():coverage
```js
var _ = jpacks;
_.string();
```
'''</example>'''
*/
function stringCreator(size) {
// console.log('stringCreator', Schema.stringify(size));
var schema = Schema.array('uint8', size);

@@ -1169,0 +1194,0 @@ return new Schema({

15

package.json

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

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

@@ -39,10 +39,11 @@ "main": "jpacks.js",

"devDependencies": {
"mocha": "^2.0.1",
"examplejs": "^0.1.18",
"istanbul": "^0.3.17",
"should": "^4.1.0",
"uglify-js": "^2.4.15",
"jdists": "^1.3.8",
"jshint": "^2.8.0",
"examplejs": "^0.1.18",
"jstrs": "^0.0.1"
"jstrs": "^0.0.1",
"leb128": "0.0.0",
"mocha": "^2.0.1",
"should": "^4.1.0",
"uglify-js": "^2.4.15"
},

@@ -56,3 +57,3 @@ "scripts": {

"test": "istanbul cover --hook-run-in-context node_modules/mocha/bin/_mocha -- -R spec",
"mocha": "jdists example.jdists.js -o test/example.js && mocha",
"mocha": "npm run example && mocha",
"dist": "npm run _update_version && npm run example && npm run _dist_dev && npm run _dist && npm run _compress && npm run test",

@@ -59,0 +60,0 @@ "lint": "jshint src/**/*.js src/*.js *.json schemas-extend/*.js"

@@ -303,2 +303,11 @@ var protobufjs = require('protobufjs');

```
* @example protobufCreator():coverage
```js
var _ = jpacks;
var _schema = _.protobuf('package MyPackage; message MyMessage { repeated int32 arr = 1; }', 'MyPackage.MyMessage', null);
_.pack(_schema, null);
_.unpack(_schema, []);
_.protobuf()('package MyPackage; message MyMessage { repeated int32 arr = 1; }', 'MyPackage.MyMessage', null);
```
'''</example>'''

@@ -305,0 +314,0 @@ */

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