token-types
Advanced tools
Comparing version 1.0.0 to 1.0.1
{ | ||
"name": "token-types", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Common token types for decoding and encoding binairy values", | ||
@@ -10,11 +10,13 @@ "author": { | ||
"scripts": { | ||
"build": "yarn run compile", | ||
"build": "npm run compile", | ||
"compile-src": "tsc -p src", | ||
"compile-test": "tsc -p test", | ||
"compile": "yarn run compile-src && yarn run compile-test", | ||
"prepare": "yarn run compile", | ||
"lint": "tslint 'src/**/*.ts' --exclude 'src/**/*.d.ts' 'test/**/*.ts' --exclude 'test/**/*.d.ts'", | ||
"compile": "npm run compile-src && npm run compile-test", | ||
"prepare": "npm run compile", | ||
"lint-ts": "tslint 'src/**/*.ts' --exclude 'src/**/*.d.ts' 'test/**/*.ts' --exclude 'test/**/*.d.ts'", | ||
"lint-md": "remark -u preset-lint-recommended .", | ||
"lint": "npm run lint-ts && npm run lint-md", | ||
"test": "mocha --require ts-node/register test", | ||
"cover-test": "nyc yarn run test", | ||
"coveralls": "yarn run cover-test && nyc report --reporter=text-lcov | coveralls" | ||
"cover-test": "nyc npm run test", | ||
"coveralls": "npm run cover-test && nyc report --reporter=text-lcov | coveralls" | ||
}, | ||
@@ -35,15 +37,21 @@ "engines": { | ||
"devDependencies": { | ||
"@types/chai": "^4.1.4", | ||
"@types/chai": "^4.1.6", | ||
"@types/mocha": "^5.2.5", | ||
"@types/node": "^10.9.4", | ||
"chai": "^4.1.2", | ||
"copyfiles": "^2.0.0", | ||
"@types/node": "^10.12.0", | ||
"chai": "^4.2.0", | ||
"coveralls": "^3.0.2", | ||
"mocha": "^5.2.0", | ||
"nyc": "^13.0.1", | ||
"nyc": "^13.1.0", | ||
"remark-cli": "^6.0.0", | ||
"remark-preset-lint-recommended": "^3.0.2", | ||
"ts-node": "^7.0.1", | ||
"tslint": "^5.11.0", | ||
"typescript": "^3.0.3" | ||
"typescript": "^3.1.3" | ||
}, | ||
"dependencies": {} | ||
"dependencies": {}, | ||
"remarkConfig": { | ||
"plugins": [ | ||
"preset-lint-recommended" | ||
] | ||
} | ||
} |
@@ -6,3 +6,4 @@ [![Build Status](https://travis-ci.org/Borewit/token-types.svg?branch=master)](https://travis-ci.org/Borewit/token-types) | ||
[![coveralls](https://coveralls.io/repos/github/Borewit/token-types/badge.svg?branch=master)](https://coveralls.io/github/Borewit/token-types?branch=master) | ||
[![NSP Status](https://nodesecurity.io/orgs/borewit/projects/a193313e-00be-4611-bcba-f68773e5704c/badge)](https://nodesecurity.io/orgs/borewit/projects/a193313e-00be-4611-bcba-f68773e5704c) | ||
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/4723ce4613fc49cda8db5eed29f18834)](https://www.codacy.com/app/Borewit/token-types?utm_source=github.com&utm_medium=referral&utm_content=Borewit/token-types&utm_campaign=Badge_Grade) | ||
[![Known Vulnerabilities](https://snyk.io/test/github/Borewit/token-types/badge.svg?targetFile=package.json)](https://snyk.io/test/github/Borewit/token-types?targetFile=package.json) | ||
@@ -15,27 +16,37 @@ A primitive token library used to read from, and to write a node `Buffer`. | ||
* `UINT8` | ||
* `UINT16_BE`, `UINT16_LE` | ||
* `UINT24_BE`, `UINT24_LE` | ||
* `UINT32_BE`, `UINT32_LE` | ||
* `UINT64_BE`, `UINT64_LE` * | ||
* `INT8` | ||
* `INT16_BE`, `INT16_LE` | ||
* `INT24_BE`, `INT24_LE` | ||
* `INT32_BE`, `INT32_LE` | ||
* `INT64_BE`, `UINT64_LE` * | ||
* `UINT8` | ||
* `UINT16_BE`, `UINT16_LE` | ||
* `UINT24_BE`, `UINT24_LE` | ||
* `UINT32_BE`, `UINT32_LE` | ||
* `UINT64_BE`, `UINT64_LE`* | ||
* `INT8` | ||
* `INT16_BE`, `INT16_LE` | ||
* `INT24_BE`, `INT24_LE` | ||
* `INT32_BE`, `INT32_LE` | ||
* `INT64_BE`, `UINT64_LE`* | ||
String types: | ||
* Windows-1252 | ||
* ISO-8859-1 | ||
* Windows-1252 | ||
* ISO-8859-1 | ||
*) The 64-bit tokens are best effort based, since JavaScript limit value size to less than 2^64. | ||
*) The 64-bit tokens are best effort based, since JavaScript limit value size to less than 2^64. | ||
[npm-url]: https://npmjs.org/package/token-types | ||
[npm-image]: https://badge.fury.io/js/token-types.svg | ||
[npm-downloads-image]: http://img.shields.io/npm/dm/token-types.svg | ||
Complex tokens can be added, which makes very suitable for reading binary files or network messages: | ||
```JavaScript | ||
public static ExtendedHeader: Token.IGetToken<IExtendedHeader> = { | ||
len: 10, | ||
[travis-url]: https://travis-ci.org/Borewit/token-types | ||
[travis-image]: https://api.travis-ci.org/Borewit/token-types.svg?branch=master | ||
[coveralls-url]: https://coveralls.io/github/Borewit/token-types?branch=master | ||
[coveralls-image]: https://coveralls.io/repos/github/Borewit/token-types/badge.svg?branch=master | ||
get: (buf, off): IExtendedHeader => { | ||
return { | ||
// Extended header size | ||
size: Token.UINT32_BE.get(buf, off), | ||
// Extended Flags | ||
extendedFlags: Token.UINT16_BE.get(buf, off + 4), | ||
// Size of padding | ||
sizeOfPadding: Token.UINT32_BE.get(buf, off + 6), | ||
// CRC data present | ||
crcDataPresent: common.strtokBITSET.get(buf, off + 4, 31) | ||
}; | ||
} | ||
}; | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
323206
9
50
12