Comparing version 1.0.0-beta3 to 1.0.0
@@ -25,9 +25,30 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
module.exports.InvalidTypeidError = TypedError({ | ||
type: 'thrift-invalid-typeid', | ||
message: 'invalid typeid {typeid} of {what}; expects one of the values in TYPE', | ||
typeid: null, | ||
module.exports.TypeIdMismatch = TypedError({ | ||
type: 'thrift-typeid-mismatch', | ||
message: 'encoded {what} typeid {encoded} doesn\'t match ' + | ||
'expected type "{expected}" (id: {expectedId})', | ||
encoded: null, | ||
expected: null, | ||
expectedId: null, | ||
what: null | ||
}); | ||
module.exports.MapKeyTypeIdMismatch = TypedError({ | ||
type: 'thrift-map-key-typeid-mismatch', | ||
message: 'encoded map key typeid {encoded} doesn\'t match ' + | ||
'expected type "{expected}" (id: {expectedId})', | ||
encoded: null, | ||
expected: null, | ||
expectedId: null | ||
}); | ||
module.exports.MapValTypeIdMismatch = TypedError({ | ||
type: 'thrift-map-val-typeid-mismatch', | ||
message: 'encoded map value typeid {encoded} doesn\'t match ' + | ||
'expected type "{expected}" (id: {expectedId})', | ||
encoded: null, | ||
expected: null, | ||
expectedId: null | ||
}); | ||
module.exports.InvalidSizeError = TypedError({ | ||
@@ -39,1 +60,60 @@ type: 'thrift-invalid-size', | ||
}); | ||
module.exports.InvalidTypeidError = TypedError({ | ||
type: 'thrift-invalid-typeid', | ||
message: 'invalid typeid {typeid} of {what}' + | ||
'; expects one of the values in TYPE', | ||
typeid: null, | ||
what: null | ||
}); | ||
module.exports.UnexpectedFieldValueTypeidError = TypedError({ | ||
type: 'thrift-unexpected-field-value-typeid', | ||
message: 'unexpected typeid {typeid} ({typeName}) for field "{fieldName}"' + | ||
' with id {fieldId} on {structName};' + | ||
' expected {expectedTypeid} ({expectedTypeName})', | ||
typeid: null, | ||
typeName: null, | ||
expectedTypeid: null, | ||
expectedTypeName: null, | ||
fieldName: null, | ||
fieldId: null, | ||
structName: null | ||
}); | ||
module.exports.FieldRequiredError = TypedError({ | ||
type: 'thrift-required-field', | ||
message: 'missing required field "{name}" with id {id} on {structName}', | ||
name: null, | ||
id: null, | ||
structName: null, | ||
what: null | ||
}); | ||
module.exports.UnexpectedMapTypeAnnotation = TypedError({ | ||
type: 'thrift-unexpected-map-type-annotation', | ||
message: 'unexpected map js.type annotation "{mapType}"', | ||
mapType: null | ||
}); | ||
module.exports.InvalidEnumerationTypeError = TypedError({ | ||
type: 'thrift-invalid-enumeration-type', | ||
message: 'name must be a string for enumeration {enumName}, got: {name} ({nameType})', | ||
enumName: null, | ||
name: null, | ||
nameType: null | ||
}); | ||
module.exports.InvalidEnumerationNameError = TypedError({ | ||
type: 'thrift-invalid-enumeration-name', | ||
message: 'name must be a valid member of enumeration {enumName}, got: {name}', | ||
enumName: null, | ||
name: null | ||
}); | ||
module.exports.InvalidEnumerationValueError = TypedError({ | ||
type: 'thrift-invalid-enumeration-value', | ||
message: 'value must be a valid member of enumeration {enumName}, got: {value}', | ||
enumName: null, | ||
value: null | ||
}); |
36
index.js
@@ -54,1 +54,37 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
module.exports.TStructRW = ttypes[TYPE.STRUCT]; | ||
module.exports.BinaryRW = require('./binary').BinaryRW; | ||
module.exports.ThriftBinary = require('./binary').ThriftBinary; | ||
module.exports.BooleanRW = require('./boolean').BooleanRW; | ||
module.exports.ThriftBoolean = require('./boolean').ThriftBoolean; | ||
module.exports.ByteRW = require('./byte').ByteRW; | ||
module.exports.ThriftByte = require('./byte').ThriftByte; | ||
module.exports.DoubleRW = require('./double').DoubleRW; | ||
module.exports.ThriftDouble = require('./double').ThriftDouble; | ||
module.exports.I16RW = require('./i16').I16RW; | ||
module.exports.ThriftI16 = require('./i16').ThriftI16; | ||
module.exports.I32RW = require('./i32').I32RW; | ||
module.exports.ThriftI32 = require('./i32').ThriftI32; | ||
module.exports.I64RW = require('./i64').I64RW; | ||
module.exports.ThriftI64 = require('./i64').ThriftI64; | ||
module.exports.ListRW = require('./list').ListRW; | ||
module.exports.ThriftList = require('./list').ThriftList; | ||
module.exports.ThriftSet = require('./set').ThriftSet; | ||
module.exports.MapObjectRW = require('./map-object').MapObjectRW; | ||
module.exports.MapEntriesRW = require('./map-entries').MapEntriesRW; | ||
module.exports.StringRW = require('./string').StringRW; | ||
module.exports.ThriftString = require('./string').ThriftString; | ||
module.exports.VoidRW = require('./void').VoidRW; | ||
module.exports.ThriftVoid = require('./void').ThriftVoid; | ||
module.exports.Thrift = require('./thrift').Thrift; |
@@ -9,4 +9,33 @@ # Migration | ||
<!-- | ||
# Upgrading from v1 to v2 | ||
--> | ||
# Upgrading from thriftify to thriftrw | ||
Loading a spec and using it to read and write types. | ||
```js | ||
var source = fs.readFileSync('my.thrift', 'ascii'); | ||
// Before: | ||
var thriftify = require('thriftify'); | ||
var thrift = thriftify.parseSpec(source); | ||
// After: | ||
var Thrift = require('thriftrw').Thrift; | ||
var thrift = new Thrift({source: source}); | ||
var args = thrift.getType('MyService::myFunction_args'); | ||
var struct = args.fromBuffer(buffer); | ||
var buffer = args.toBuffer(struct) | ||
``` | ||
Reading and writing a type | ||
```js | ||
// Before: | ||
var buffer = thriftify.toBuffer(struct, spec, 'MyStruct') | ||
var struct = thriftify.fromBuffer(buffer, spec, 'MyStruct') | ||
// After: | ||
var MyStruct = spec.getType('MyStruct'); | ||
var buffer = MyStruct.toBuffer(struct); | ||
var struct = MyStruct.fromBuffer(buffer); | ||
``` |
{ | ||
"name": "thriftrw", | ||
"version": "1.0.0-beta3", | ||
"version": "1.0.0", | ||
"description": "thrift encoding/decoding using bufrw", | ||
@@ -21,9 +21,11 @@ "keywords": [], | ||
"bufrw": "^0.9.4", | ||
"error": "^5.1.1" | ||
"error": "^5.1.1", | ||
"pegjs": "^0.8.0" | ||
}, | ||
"devDependencies": { | ||
"coveralls": "^2.10.0", | ||
"debug": "^2.1.2", | ||
"faucet": "0.0.1", | ||
"istanbul": "^0.3.5", | ||
"itape": "^1.5.0", | ||
"lint-trap": "^1.0.0", | ||
"opn": "^1.0.1", | ||
@@ -33,4 +35,3 @@ "pre-commit": "0.0.9", | ||
"uber-licence": "^1.2.0", | ||
"debug": "^2.1.2", | ||
"lodash": "^3.5.0" | ||
"uber-standard": "^3.6.4" | ||
}, | ||
@@ -45,12 +46,11 @@ "licenses": [ | ||
"add-licence": "uber-licence", | ||
"check-cover": "istanbul check-coverage --branches=100 --lines=100 --functions=100", | ||
"check-licence": "uber-licence --dry", | ||
"check-ls": "npm ls 1>/dev/null", | ||
"cover": "npm run test-cover -s && npm run check-cover -s", | ||
"lint": "lint-trap .", | ||
"lint": "standard --reporter stylish -v", | ||
"test": "npm run check-ls -s && npm run lint -s && npm run cover -s", | ||
"test-cover": "istanbul cover --report html --print detail -- test/index.js", | ||
"cover": "istanbul cover --report html --print none -- test/index.js | faucet && istanbul report text && npm run check-cover -s", | ||
"check-cover": "istanbul check-coverage", | ||
"view-cover": "opn ./coverage/index.html", | ||
"trace": "itape test/index.js --trace", | ||
"travis": "npm run cover -s && istanbul report lcov && ((cat coverage/lcov.info | coveralls) || exit 0)", | ||
"view-cover": "opn ./coverage/index.html" | ||
"travis": "npm run cover -s && istanbul report lcov && ((cat coverage/lcov.info | coveralls) || exit 0)" | ||
}, | ||
@@ -57,0 +57,0 @@ "engines": { |
@@ -21,37 +21,32 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
/* eslint max-len:[200] */ | ||
/* jscs:disable maximumLineLength */ | ||
'use strict'; | ||
var thriftrw = require('../'); | ||
var TStruct = thriftrw.TStruct; | ||
var TStructRW = thriftrw.TStructRW; | ||
var TMap = thriftrw.TMap; | ||
var TList = thriftrw.TList; | ||
var TField = thriftrw.TField; | ||
var TPair = thriftrw.TPair; | ||
var testRW = require('bufrw/test_rw'); | ||
var test = require('tape'); | ||
var Buffer = require('buffer').Buffer; | ||
test('StructRW', testRW.cases(TStructRW, [ | ||
[TStruct([TField(8, 1, 123)]), new Buffer('CAABAAAAewA=', 'base64')], | ||
[TStruct([TField(11, 1, 'hello')]), new Buffer('CwABAAAABWhlbGxvAA==', 'base64')], | ||
[TStruct([TField(3, 9, 20), TField(6, 10, 10)]), new Buffer('AwAJFAYACgAKAA==', 'base64')], | ||
[TStruct([ | ||
TField(12, 1, TStruct([TField(8, 1, 10)])), | ||
TField(12, 2, TStruct([TField(11, 1, 'hello')])) | ||
]), new Buffer('DAABCAABAAAACgAMAAILAAEAAAAFaGVsbG8AAA==', 'base64')], | ||
[TStruct([ | ||
TField(13, 1, TMap(11, 12, [ | ||
TPair('key0', TStruct([ | ||
TField(12, 1, TStruct([TField(8, 1, 20)])), | ||
TField(12, 2, TStruct([TField(11, 1, 'str2')]))])), | ||
TPair('key1', TStruct([ | ||
TField(12, 1, TStruct([TField(8, 1, 10)])), | ||
TField(12, 2, TStruct([TField(11, 1, 'str1')]))]))])), | ||
TField(15, 2, TList(12, [ | ||
TStruct([TField(8, 1, 30)]), | ||
TStruct([TField(8, 1, 100)]), | ||
TStruct([TField(8, 1, 200)])])) | ||
]), new Buffer('DQABCwwAAAACAAAABGtleTAMAAEIAAEAAAAUAAwAAgsAAQAAAARzdHIyAAAAAAAEa2V5MQwAAQgAAQAAAAoADAACCwABAAAABHN0cjEAAA8AAgwAAAADCAABAAAAHgAIAAEAAABkAAgAAQAAAMgAAA==', 'base64')]])); | ||
require('./binary'); | ||
require('./boolean'); | ||
require('./byte'); | ||
require('./double'); | ||
require('./i16'); | ||
require('./i32'); | ||
require('./i64'); | ||
require('./map-entries'); | ||
require('./thrift-idl'); | ||
require('./map-object'); | ||
require('./string'); | ||
require('./tlist'); | ||
require('./tmap'); | ||
require('./tstruct'); | ||
require('./void'); | ||
require('./skip'); | ||
require('./struct'); | ||
require('./struct-skip'); | ||
require('./recursion'); | ||
require('./exception'); | ||
require('./service'); | ||
require('./thrift'); | ||
require('./list'); | ||
require('./set'); | ||
require('./map'); | ||
require('./typedef'); | ||
require('./const'); | ||
require('./default'); | ||
require('./enum'); |
43
tlist.js
@@ -26,9 +26,4 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
var inherits = require('util').inherits; | ||
var InvalidTypeidError = require('./errors').InvalidTypeidError; | ||
var InvalidSizeError = require('./errors').InvalidSizeError; | ||
var errors = require('./errors'); | ||
var LengthResult = bufrw.LengthResult; | ||
var WriteResult = bufrw.WriteResult; | ||
var ReadResult = bufrw.ReadResult; | ||
function TList(etypeid, elements) { | ||
@@ -47,11 +42,14 @@ if (!(this instanceof TList)) { | ||
this.ttypes = opts.ttypes; | ||
this.headerRW = bufrw.Series([bufrw.Int8, bufrw.Int32BE]); | ||
} | ||
inherits(TListRW, bufrw.Base); | ||
TListRW.prototype.headerRW = bufrw.Series([bufrw.Int8, bufrw.Int32BE]); | ||
TListRW.prototype.byteLength = function byteLength(list) { | ||
var etype = this.ttypes[list.etypeid]; | ||
if (!etype) { | ||
return LengthResult.error( | ||
InvalidTypeidError({typeid: list.etypeid, what: 'list::etype'})); | ||
return new bufrw.LengthResult(errors.InvalidTypeidError({ | ||
typeid: list.etypeid, | ||
what: 'list::etype' | ||
})); | ||
} | ||
@@ -63,2 +61,3 @@ | ||
t = etype.byteLength(list.elements[i]); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -69,3 +68,3 @@ return t; | ||
} | ||
return LengthResult.just(length); | ||
return new bufrw.LengthResult(null, length); | ||
}; | ||
@@ -76,4 +75,6 @@ | ||
if (!etype) { | ||
return WriteResult.error( | ||
InvalidTypeidError({typeid: list.etypeid, what: 'list::etype'})); | ||
return new bufrw.WriteResult(errors.InvalidTypeidError({ | ||
typeid: list.etypeid, | ||
what: 'list::etype' | ||
})); | ||
} | ||
@@ -83,2 +84,3 @@ | ||
buffer, offset); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -91,2 +93,3 @@ return t; | ||
t = etype.writeInto(list.elements[i], buffer, offset); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -97,3 +100,3 @@ return t; | ||
} | ||
return WriteResult.just(offset); | ||
return new bufrw.WriteResult(null, offset); | ||
}; | ||
@@ -103,2 +106,3 @@ | ||
var t = this.headerRW.readFrom(buffer, offset); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -111,3 +115,6 @@ return t; | ||
if (size < 0) { | ||
return ReadResult.error(InvalidSizeError({size: size, what: 'list::size'})); | ||
return new bufrw.ReadResult(errors.InvalidSizeError({ | ||
size: size, | ||
what: 'list::size' | ||
})); | ||
} | ||
@@ -118,3 +125,6 @@ | ||
if (!etype) { | ||
return ReadResult.error(InvalidTypeidError({typeid: list.etypeid, what: 'list::etype'})); | ||
return new bufrw.ReadResult(errors.InvalidTypeidError({ | ||
typeid: list.etypeid, | ||
what: 'list::etype' | ||
})); | ||
} | ||
@@ -124,2 +134,3 @@ | ||
t = etype.readFrom(buffer, offset); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -131,3 +142,3 @@ return t; | ||
} | ||
return ReadResult.just(offset, list); | ||
return new bufrw.ReadResult(null, offset, list); | ||
}; | ||
@@ -134,0 +145,0 @@ |
66
tmap.js
@@ -21,2 +21,3 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
/* eslint max-len:[0, 120] */ | ||
/* eslint max-statements:[0, 99] */ | ||
@@ -27,9 +28,4 @@ 'use strict'; | ||
var inherits = require('util').inherits; | ||
var InvalidTypeidError = require('./errors').InvalidTypeidError; | ||
var InvalidSizeError = require('./errors').InvalidSizeError; | ||
var errors = require('./errors'); | ||
var LengthResult = bufrw.LengthResult; | ||
var WriteResult = bufrw.WriteResult; | ||
var ReadResult = bufrw.ReadResult; | ||
function TPair(key, val) { | ||
@@ -57,16 +53,21 @@ if (!(this instanceof TPair)) { | ||
this.ttypes = opts.ttypes; | ||
this.headerRW = bufrw.Series([bufrw.Int8, bufrw.Int8, bufrw.Int32BE]); | ||
} | ||
inherits(TMapRW, bufrw.Base); | ||
TMapRW.prototype.headerRW = bufrw.Series([bufrw.Int8, bufrw.Int8, bufrw.Int32BE]); | ||
TMapRW.prototype.byteLength = function byteLength(map) { | ||
var ktype = this.ttypes[map.ktypeid]; | ||
if (!ktype) { | ||
return LengthResult.error( | ||
InvalidTypeidError({typeid: map.ktypeid, what: 'map::ktype'})); | ||
return new bufrw.LengthResult(errors.InvalidTypeidError({ | ||
what: 'map::ktype', | ||
typeid: map.ktypeid | ||
})); | ||
} | ||
var vtype = this.ttypes[map.vtypeid]; | ||
if (!vtype) { | ||
return LengthResult.error( | ||
InvalidTypeidError({typeid: map.vtypeid, what: 'map::vtype'})); | ||
return new bufrw.LengthResult(errors.InvalidTypeidError({ | ||
what: 'map::vtype', | ||
typeid: map.vtypeid | ||
})); | ||
} | ||
@@ -80,2 +81,3 @@ | ||
t = ktype.byteLength(pair.key); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -87,2 +89,3 @@ return t; | ||
t = vtype.byteLength(pair.val); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -93,3 +96,3 @@ return t; | ||
} | ||
return LengthResult.just(length); | ||
return new bufrw.LengthResult(null, length); | ||
}; | ||
@@ -100,9 +103,13 @@ | ||
if (!ktype) { | ||
return WriteResult.error( | ||
InvalidTypeidError({typeid: map.ktypeid, what: 'map::ktype'})); | ||
return new bufrw.WriteResult(errors.InvalidTypeidError({ | ||
what: 'map::ktype', | ||
typeid: map.ktypeid | ||
})); | ||
} | ||
var vtype = this.ttypes[map.vtypeid]; | ||
if (!vtype) { | ||
return WriteResult.error( | ||
InvalidTypeidError({typeid: map.vtypeid, what: 'map::vtype'})); | ||
return new bufrw.WriteResult(errors.InvalidTypeidError({ | ||
what: 'map::vtype', | ||
typeid: map.vtypeid | ||
})); | ||
} | ||
@@ -112,2 +119,3 @@ | ||
[map.ktypeid, map.vtypeid, map.pairs.length], buffer, offset); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -122,2 +130,3 @@ return t; | ||
t = ktype.writeInto(pair.key, buffer, offset); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -129,2 +138,3 @@ return t; | ||
t = vtype.writeInto(pair.val, buffer, offset); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -135,3 +145,3 @@ return t; | ||
} | ||
return WriteResult.just(offset); | ||
return new bufrw.WriteResult(null, offset); | ||
}; | ||
@@ -141,2 +151,3 @@ | ||
var t = this.headerRW.readFrom(buffer, offset); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -150,3 +161,6 @@ return t; | ||
if (size < 0) { | ||
return ReadResult.error(InvalidSizeError({size: size, what: 'map::size'})); | ||
return new bufrw.ReadResult(errors.InvalidSizeError({ | ||
size: size, | ||
what: 'map::size' | ||
})); | ||
} | ||
@@ -157,9 +171,13 @@ | ||
if (!ktype) { | ||
return ReadResult.error( | ||
InvalidTypeidError({typeid: map.ktypeid, what: 'map::ktype'})); | ||
return new bufrw.ReadResult(errors.InvalidTypeidError({ | ||
what: 'map::ktype', | ||
typeid: map.ktypeid | ||
})); | ||
} | ||
var vtype = this.ttypes[map.vtypeid]; | ||
if (!vtype) { | ||
return ReadResult.error( | ||
InvalidTypeidError({typeid: map.vtypeid, what: 'map::vtype'})); | ||
return new bufrw.ReadResult(errors.InvalidTypeidError({ | ||
what: 'map::vtype', | ||
typeid: map.vtypeid | ||
})); | ||
} | ||
@@ -169,2 +187,3 @@ | ||
t = ktype.readFrom(buffer, offset); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -177,2 +196,3 @@ return t; | ||
t = vtype.readFrom(buffer, offset); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -186,3 +206,3 @@ return t; | ||
} | ||
return ReadResult.just(offset, map); | ||
return new bufrw.ReadResult(null, offset, map); | ||
}; | ||
@@ -189,0 +209,0 @@ |
@@ -27,8 +27,4 @@ // Copyright (c) 2015 Uber Technologies, Inc. | ||
var inherits = require('util').inherits; | ||
var InvalidTypeidError = require('./errors').InvalidTypeidError; | ||
var errors = require('./errors'); | ||
var LengthResult = bufrw.LengthResult; | ||
var WriteResult = bufrw.WriteResult; | ||
var ReadResult = bufrw.ReadResult; | ||
function TField(typeid, id, val) { | ||
@@ -65,3 +61,3 @@ if (!(this instanceof TField)) { | ||
if (!type) { | ||
return LengthResult.error(InvalidTypeidError({ | ||
return new bufrw.LengthResult(errors.InvalidTypeidError({ | ||
typeid: field.typeid, what: 'field::type' | ||
@@ -74,2 +70,3 @@ })); | ||
t = type.byteLength(field.val); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -80,3 +77,3 @@ return t; | ||
} | ||
return LengthResult.just(length); | ||
return new bufrw.LengthResult(null, length); | ||
}; | ||
@@ -90,3 +87,3 @@ | ||
if (!type) { | ||
return LengthResult.error(InvalidTypeidError({ | ||
return new bufrw.WriteResult(errors.InvalidTypeidError({ | ||
typeid: field.typeid, what: 'field::type' | ||
@@ -97,2 +94,3 @@ })); | ||
t = bufrw.Int8.writeInto(field.typeid, buffer, offset); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -104,2 +102,3 @@ return t; | ||
t = bufrw.Int16BE.writeInto(field.id, buffer, offset); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -111,2 +110,3 @@ return t; | ||
t = type.writeInto(field.val, buffer, offset); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -118,2 +118,3 @@ return t; | ||
t = bufrw.Int8.writeInto(TYPE.STOP, buffer, offset); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -123,3 +124,3 @@ return t; | ||
offset = t.offset; | ||
return WriteResult.just(offset); | ||
return new bufrw.WriteResult(null, offset); | ||
}; | ||
@@ -133,2 +134,3 @@ | ||
t = bufrw.Int8.readFrom(buffer, offset); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -144,4 +146,5 @@ return t; | ||
if (!type) { | ||
return LengthResult.error(InvalidTypeidError({ | ||
typeid: typeid, what: 'field::type' | ||
return new bufrw.ReadResult(errors.InvalidTypeidError({ | ||
typeid: typeid, | ||
what: 'field::type' | ||
})); | ||
@@ -151,2 +154,3 @@ } | ||
t = bufrw.Int16BE.readFrom(buffer, offset); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -159,2 +163,3 @@ return t; | ||
t = type.readFrom(buffer, offset); | ||
// istanbul ignore if | ||
if (t.err) { | ||
@@ -167,3 +172,3 @@ return t; | ||
} | ||
return ReadResult.just(offset, struct); | ||
return new bufrw.ReadResult(null, offset, struct); | ||
}; | ||
@@ -170,0 +175,0 @@ |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 2 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
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
329039
108
5876
0
3
1
14
4
+ Addedpegjs@^0.8.0
+ Addedpegjs@0.8.0(transitive)