@bare-ts/lib 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,5 @@
1
+ export declare class AssertionError extends Error {
2
+ readonly name: "AssertionError";
3
+ constructor(message: string);
4
+ }
5
+ export default function assert(test: boolean, message: Error | string): asserts test;
@@ -0,0 +1,24 @@
1
+ // src/util/assert.ts
2
+ var AssertionError = class extends Error {
3
+ constructor(message) {
4
+ super(message);
5
+ this.name = "AssertionError";
6
+ }
7
+ };
8
+ function assert(test, message) {
9
+ if (!test) {
10
+ if (message instanceof Error) {
11
+ throw message;
12
+ }
13
+ const e = new AssertionError(message);
14
+ if (Error.captureStackTrace) {
15
+ Error.captureStackTrace(e, assert);
16
+ }
17
+ throw e;
18
+ }
19
+ }
20
+ export {
21
+ AssertionError,
22
+ assert as default
23
+ };
24
+ //# sourceMappingURL=assert.js.map
@@ -0,0 +1 @@
1
+ export declare const IS_LITTLE_ENDIAN_PLATFORM: boolean;
@@ -0,0 +1,9 @@
1
+ export declare function isI8(val: number): boolean;
2
+ export declare function isI16(val: number): boolean;
3
+ export declare function isI32(val: number): boolean;
4
+ export declare function isI64(val: bigint): boolean;
5
+ export declare function isSafeU64(val: number): boolean;
6
+ export declare function isU8(val: number): boolean;
7
+ export declare function isU16(val: number): boolean;
8
+ export declare function isU32(val: number): boolean;
9
+ export declare function isU64(val: bigint): boolean;
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@bare-ts/lib",
3
+ "version": "0.1.0",
4
+ "description": "TypeScript library for BARE, a compact and simple binary-serialization format",
5
+ "keywords": [
6
+ "bare",
7
+ "binary format",
8
+ "decoder",
9
+ "encoder",
10
+ "serialization",
11
+ "schema"
12
+ ],
13
+ "author": "Victorien Elvinger (victorien.elvinger.fr)",
14
+ "license": "Apache-2.0",
15
+ "homepage": "https://baremessages.org",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/bare-ts/lib"
19
+ },
20
+ "bugs": {
21
+ "url": "https://github.com/bare-ts/lib/issues"
22
+ },
23
+ "engines": {
24
+ "node": ">= 12"
25
+ },
26
+ "type": "module",
27
+ "main": "./dist/index.cjs",
28
+ "module": "./dist/index.js",
29
+ "es2015": "./dist/index.js",
30
+ "types": "./dist/index.d.ts",
31
+ "browser": {
32
+ "assert": "./dist/util/assert.js"
33
+ },
34
+ "exports": {
35
+ "import": "./dist/index.js",
36
+ "require": "./dist/index.cjs"
37
+ },
38
+ "sideEffects": false,
39
+ "files": [
40
+ "dist/*.cjs",
41
+ "dist/*.d.ts",
42
+ "dist/*.js",
43
+ "dist/**/*.d.ts",
44
+ "dist/**/*.js"
45
+ ],
46
+ "scripts": {
47
+ "build": "tsc -b src && node ./scripts/build.js",
48
+ "clean": "rm -rf dist coverage",
49
+ "prepublishOnly": "npm run clean && npm run test",
50
+ "test": "npm run build && tsc -b tests && oletus tests/**/*.test.js"
51
+ },
52
+ "size-limit": [
53
+ {
54
+ "path": "./dist/index.js",
55
+ "limit": "10 kB"
56
+ }
57
+ ],
58
+ "devDependencies": {
59
+ "@types/node": "^17.0.6",
60
+ "esbuild": "^0.14.10",
61
+ "oletus": "^3.2.0",
62
+ "prettier": "^2.5.1",
63
+ "typescript": "^4.5.4",
64
+ "validate-commit-message": "^3.2.0"
65
+ }
66
+ }