@colabo-utils/i-verify 0.1.6
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.
- package/README.md +9 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/lib/assertion.d.ts +4 -0
- package/dist/cjs/lib/params.d.ts +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/assertion.d.ts +4 -0
- package/dist/esm/lib/params.d.ts +1 -0
- package/dist/index.d.ts +7 -0
- package/package.json +34 -0
package/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Intro
|
|
2
|
+
|
|
3
|
+
Provides verify support for the Colabo.Space Ecosystem
|
|
4
|
+
|
|
5
|
+
This is isomorphic puzzle and can be used both in backend and frontend system
|
|
6
|
+
|
|
7
|
+
# How to use the puzzle
|
|
8
|
+
|
|
9
|
+
It currently offers the set of [assertion functions](./lib/assertion.ts) that makes coding more consistent
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});class e extends Error{constructor(e=""){super(),this.message=e}}const s=e;exports.MODULE_NAME="@colabo-flow/i-core",exports.assert=(e,r)=>{if(!e)throw new s(r)},exports.assertIsDefined=function(e,r){if(null==e)throw new s(`Expected 'val' to be defined, but received ${e}. Error message: ${r}`)};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../lib/assertion.ts","../../lib/params.ts"],"sourcesContent":["interface IAssertionError extends Error {\n\tname: string;\n\tmessage: string;\n\tstack?: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\ninterface AssertionErrorConstructor {\n\t// new (message?: string): IAssertionError;\n\t// (message?: string): IAssertionError;\n\t// readonly prototype: IAssertionError;\n}\n\nclass CAssertionError extends Error implements IAssertionError, AssertionErrorConstructor {\n\tconstructor(public message: string = \"\") {\n\t\tsuper();\n\t}\n}\n// declare let AssertionError: AssertionErrorConstructor;\nconst AssertionError = CAssertionError;\n\n// This is necessary to avoid the error: `Assertions require every name in the call target to be declared with an explicit type annotation.ts(2775)`\n// `assertion.ts(16, 14): 'assert' needs an explicit type annotation.`\n// when using: `assert(pathStr || pathParts, \"Either `pathStr` or `pathParts` should be defined\");` as in [transform.ts](/colabo/src/isomorphic/puzzles/transform/json/lib/transform.ts)\n// https://github.com/microsoft/TypeScript/issues/36931#issuecomment-846131999\ntype Assert = (condition: unknown, message?: string) => asserts condition;\nexport const assert: Assert = (condition: unknown, message?: string): asserts condition => {\n\tif (!condition) {\n\t\tthrow new AssertionError(message);\n\t}\n};\n\nexport function assertIsDefined<T>(val: T | undefined, message?: string): asserts val is NonNullable<T> {\n\tif (val === undefined || val === null) {\n\t\tthrow new AssertionError(`Expected 'val' to be defined, but received ${val}. Error message: ${message}`);\n\t}\n}\n","export const MODULE_NAME: string = \"@colabo-flow/i-core\";\n"],"names":["CAssertionError","Error","constructor","message","super","this","AssertionError","condition","val"],"mappings":"oEAaA,MAAMA,UAAwBC,MAC7BC,YAAmBC,EAAkB,IACpCC,QADkBC,KAAOF,QAAPA,CAElB,EAGF,MAAMG,EAAiBN,sBCnBY,qCD0BL,CAACO,EAAoBJ,KAClD,IAAKI,EACJ,MAAM,IAAID,EAAeH,EACzB,0BAGc,SAAmBK,EAAoBL,GACtD,GAAIK,QACH,MAAM,IAAIF,EAAe,8CAA8CE,qBAAuBL,IAEhG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MODULE_NAME: string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const e="@colabo-flow/i-core";class o extends Error{constructor(e=""){super(),this.message=e}}const r=o,t=(e,o)=>{if(!e)throw new r(o)};function s(e,o){if(null==e)throw new r(`Expected 'val' to be defined, but received ${e}. Error message: ${o}`)}export{e as MODULE_NAME,t as assert,s as assertIsDefined};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../lib/params.ts","../../lib/assertion.ts"],"sourcesContent":["export const MODULE_NAME: string = \"@colabo-flow/i-core\";\n","interface IAssertionError extends Error {\n\tname: string;\n\tmessage: string;\n\tstack?: string;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-empty-interface\ninterface AssertionErrorConstructor {\n\t// new (message?: string): IAssertionError;\n\t// (message?: string): IAssertionError;\n\t// readonly prototype: IAssertionError;\n}\n\nclass CAssertionError extends Error implements IAssertionError, AssertionErrorConstructor {\n\tconstructor(public message: string = \"\") {\n\t\tsuper();\n\t}\n}\n// declare let AssertionError: AssertionErrorConstructor;\nconst AssertionError = CAssertionError;\n\n// This is necessary to avoid the error: `Assertions require every name in the call target to be declared with an explicit type annotation.ts(2775)`\n// `assertion.ts(16, 14): 'assert' needs an explicit type annotation.`\n// when using: `assert(pathStr || pathParts, \"Either `pathStr` or `pathParts` should be defined\");` as in [transform.ts](/colabo/src/isomorphic/puzzles/transform/json/lib/transform.ts)\n// https://github.com/microsoft/TypeScript/issues/36931#issuecomment-846131999\ntype Assert = (condition: unknown, message?: string) => asserts condition;\nexport const assert: Assert = (condition: unknown, message?: string): asserts condition => {\n\tif (!condition) {\n\t\tthrow new AssertionError(message);\n\t}\n};\n\nexport function assertIsDefined<T>(val: T | undefined, message?: string): asserts val is NonNullable<T> {\n\tif (val === undefined || val === null) {\n\t\tthrow new AssertionError(`Expected 'val' to be defined, but received ${val}. Error message: ${message}`);\n\t}\n}\n"],"names":["MODULE_NAME","CAssertionError","Error","constructor","message","super","this","AssertionError","assert","condition","assertIsDefined","val"],"mappings":"AAAO,MAAMA,EAAsB,sBCanC,MAAMC,UAAwBC,MAC7BC,YAAmBC,EAAkB,IACpCC,QADkBC,KAAOF,QAAPA,CAElB,EAGF,MAAMG,EAAiBN,EAOVO,EAAiB,CAACC,EAAoBL,KAClD,IAAKK,EACJ,MAAM,IAAIF,EAAeH,EACzB,EAGc,SAAAM,EAAmBC,EAAoBP,GACtD,GAAIO,QACH,MAAM,IAAIJ,EAAe,8CAA8CI,qBAAuBP,IAEhG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const MODULE_NAME: string;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const MODULE_NAME: string;
|
|
2
|
+
|
|
3
|
+
declare type Assert = (condition: unknown, message?: string) => asserts condition;
|
|
4
|
+
declare const assert: Assert;
|
|
5
|
+
declare function assertIsDefined<T>(val: T | undefined, message?: string): asserts val is NonNullable<T>;
|
|
6
|
+
|
|
7
|
+
export { MODULE_NAME, assert, assertIsDefined };
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@colabo-utils/i-verify",
|
|
3
|
+
"description": "Provides verify and assert utilities",
|
|
4
|
+
"version": "0.1.6",
|
|
5
|
+
"private": false,
|
|
6
|
+
"type": "module",
|
|
7
|
+
"publishConfig": {
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git://github.com/Cha-OS/colabo.git"
|
|
14
|
+
},
|
|
15
|
+
"main": "dist/cjs/index.js",
|
|
16
|
+
"module": "dist/esm/index.js",
|
|
17
|
+
"types": "dist/index.d.ts",
|
|
18
|
+
"files": [
|
|
19
|
+
"dist"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "rollup -c"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@rollup/plugin-commonjs": "^23.0.2",
|
|
26
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
27
|
+
"rollup": "^2.79.1",
|
|
28
|
+
"rollup-plugin-dts": "^5.0.0",
|
|
29
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
30
|
+
"rollup-plugin-postcss": "^4.0.2",
|
|
31
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
32
|
+
"rollup-plugin-typescript2": "^0.34.1"
|
|
33
|
+
}
|
|
34
|
+
}
|