diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index a57a62e..0000000 --- a/.github/workflows/ci.yaml +++ /dev/null @@ -1,147 +0,0 @@ -name: ci -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - - test_node: - runs-on: ${{ matrix.os }} - strategy: - matrix: - node: [ '14', '15' ,'16', '17' ] - os: [ windows-latest, ubuntu-latest ] - name: Test with Node v${{ matrix.node }} on ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node }} - - uses: bahmutov/npm-install@v1 - - run: yarn build - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: yarn test:node - test_deno: - runs-on: ubuntu-latest - name: test with Deno - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '15' - - name: Cache - uses: actions/cache@v3 - with: - path: ~/.cache/deno - key: deno-${{ runner.os }}-${{ hashFiles('deno-lock.json') }} - restore-keys: | - deno-${{ runner.os }}-${{ hashFiles('deno-lock.json') }} - deno-${{ runner.os }}- - deno- - - uses: denoland/setup-deno@v1 - with: - deno-version: v1.x - - run: deno --version - - uses: bahmutov/npm-install@v1 - - run: yarn build - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: yarn test:deno - check_if_version_upgraded: - name: Check if version upgrade - # We run this only if it's a push on the default branch or if it's a PR from a - # branch (meaning not a PR from a fork). It would be more straightforward to test if secrets.NPM_TOKEN is - # defined but GitHub Action don't allow it yet. - if: | - github.event_name == 'push' || - github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login - runs-on: ubuntu-latest - needs: - - test_node - - test_deno - outputs: - from_version: ${{ steps.step1.outputs.from_version }} - to_version: ${{ steps.step1.outputs.to_version }} - is_upgraded_version: ${{ steps.step1.outputs.is_upgraded_version }} - is_pre_release: ${{steps.step1.outputs.is_pre_release }} - steps: - - uses: garronej/ts-ci@v2.1.0 - id: step1 - with: - action_name: is_package_json_version_upgraded - branch: ${{ github.head_ref || github.ref }} - - publish: - runs-on: ubuntu-latest - needs: - - check_if_version_upgraded - # We create a release only if the version have been upgraded and we are on the main branch - # or if we are on a branch of the repo that has an PR open on main. - if: | - needs.check_if_version_upgraded.outputs.is_upgraded_version == 'true' && - ( - github.event_name == 'push' || - needs.check_if_version_upgraded.outputs.is_pre_release == 'true' - ) - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - ref: ${{ github.ref }} - - run: rm -r .github - - name: Remove tmp_branch if it exists - run: git push origin :tmp_branch || true - - run: git checkout -b tmp_branch - - uses: actions/setup-node@v3 - with: - registry-url: https://registry.npmjs.org/ - - uses: bahmutov/npm-install@v1 - - run: yarn build - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: | - npx -y -p denoify@1.5.2 enable_short_npm_import_path - npx -y -p denoify@1.5.2 remove_deno_dist_from_gitignore - env: - DRY_RUN: "0" - - run: | - if [ "$(npm show . version)" = "$VERSION" ]; then - echo "This version is already published" - exit 0 - fi - if [ "$NODE_AUTH_TOKEN" = "" ]; then - echo "Can't publish on NPM, You must first create a secret called NPM_TOKEN that contains your NPM auth token. https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets" - false - fi - EXTRA_ARGS="" - if [ "$IS_PRE_RELEASE" = "true" ]; then - EXTRA_ARGS="--tag next" - fi - npm publish $EXTRA_ARGS - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} - VERSION: ${{ needs.check_if_version_upgraded.outputs.to_version }} - IS_PRE_RELEASE: ${{ needs.check_if_version_upgraded.outputs.is_pre_release }} - - run: | - git config --global user.name "actions" - git config --global user.email actions@github.com - git add -A - git commit -am "Adding deno distribution files and moving files from /dist to /" - git push origin tmp_branch - - uses: softprops/action-gh-release@v1 - with: - name: Release v${{ needs.check_if_version_upgraded.outputs.to_version }} - tag_name: v${{ needs.check_if_version_upgraded.outputs.to_version }} - target_commitish: tmp_branch - generate_release_notes: false - draft: false - prerelease: ${{ needs.check_if_version_upgraded.outputs.is_pre_release == 'true' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Remove tmp_branch - run: git push origin :tmp_branch diff --git a/.gitignore b/.gitignore index e5ab84a..13be271 100644 --- a/.gitignore +++ b/.gitignore @@ -1,44 +1,2 @@ -# Logs -logs -*.log -npm-debug.log* - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directories -node_modules -jspm_packages - -# Optional npm cache directory -.npm - -# Optional REPL history -.node_repl_history - -.vscode - -.DS_Store - -/dist -/deno_dist + +/node_modules diff --git a/Equals.d.ts b/Equals.d.ts new file mode 100644 index 0000000..920a4e6 --- /dev/null +++ b/Equals.d.ts @@ -0,0 +1,4 @@ +import type { Unite } from "./tools/Unite"; +import type { StrictEquals } from "./tools/StrictEquals"; +/** https://docs.tsafe.dev/main/equals */ +export type Equals = StrictEquals, Unite>; diff --git a/Equals.js b/Equals.js new file mode 100644 index 0000000..a1e8026 --- /dev/null +++ b/Equals.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// Credit https://stackoverflow.com/a/52473108/3570903 +//# sourceMappingURL=Equals.js.map \ No newline at end of file diff --git a/Equals.js.map b/Equals.js.map new file mode 100644 index 0000000..cd51b08 --- /dev/null +++ b/Equals.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Equals.js","sourceRoot":"","sources":["src/Equals.ts"],"names":[],"mappings":";;AAOA,sDAAsD"} \ No newline at end of file diff --git a/Extends.d.ts b/Extends.d.ts new file mode 100644 index 0000000..df7a1a8 --- /dev/null +++ b/Extends.d.ts @@ -0,0 +1,7 @@ +import { StrictEquals } from "./tools/StrictEquals"; +/** + * @see + * + * Usage example: assert>(); + **/ +export type Extends = StrictEquals extends true ? true : StrictEquals extends true ? false : StrictEquals extends true ? true : StrictEquals extends true ? true : StrictEquals extends true ? false : StrictEquals extends true ? false : A1 extends A2 ? true : false; diff --git a/Extends.js b/Extends.js new file mode 100644 index 0000000..c45c6c9 --- /dev/null +++ b/Extends.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Extends.js.map \ No newline at end of file diff --git a/Extends.js.map b/Extends.js.map new file mode 100644 index 0000000..fde128f --- /dev/null +++ b/Extends.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Extends.js","sourceRoot":"","sources":["src/Extends.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/MethodNames.d.ts b/MethodNames.d.ts new file mode 100644 index 0000000..4f55fc6 --- /dev/null +++ b/MethodNames.d.ts @@ -0,0 +1,4 @@ +/** https://docs.tsafe.dev/methodnames */ +export type MethodNames = NonNullable<{ + [Key in keyof Api]: Api[Key] extends ((...args: any[]) => unknown) | undefined ? Key : never; +}[keyof Api]>; diff --git a/MethodNames.js b/MethodNames.js new file mode 100644 index 0000000..0709e1f --- /dev/null +++ b/MethodNames.js @@ -0,0 +1,5 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/ban-types */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=MethodNames.js.map \ No newline at end of file diff --git a/MethodNames.js.map b/MethodNames.js.map new file mode 100644 index 0000000..585cf01 --- /dev/null +++ b/MethodNames.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MethodNames.js","sourceRoot":"","sources":["src/MethodNames.ts"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,iDAAiD"} \ No newline at end of file diff --git a/Not.d.ts b/Not.d.ts new file mode 100644 index 0000000..c5bd642 --- /dev/null +++ b/Not.d.ts @@ -0,0 +1,2 @@ +/** https://docs.tsafe.dev/main/not */ +export type Not = B extends true ? false : true; diff --git a/Not.js b/Not.js new file mode 100644 index 0000000..7ec187a --- /dev/null +++ b/Not.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Not.js.map \ No newline at end of file diff --git a/Not.js.map b/Not.js.map new file mode 100644 index 0000000..a253ef5 --- /dev/null +++ b/Not.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Not.js","sourceRoot":"","sources":["src/Not.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/Param0.d.ts b/Param0.d.ts new file mode 100644 index 0000000..d33232f --- /dev/null +++ b/Param0.d.ts @@ -0,0 +1,7 @@ +import type { Parameters } from "./Parameters"; +type NonUndefined = T extends undefined ? never : T; +/** Shorthand for Parameters[0] https://docs.tsafe.dev/param0 */ +export type Param0 unknown) | null | undefined | false | ""> = [ + Parameters +] extends [never] ? never : Parameters extends [] ? void : NonUndefined[0]>; +export {}; diff --git a/Param0.js b/Param0.js new file mode 100644 index 0000000..efb2100 --- /dev/null +++ b/Param0.js @@ -0,0 +1,4 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Param0.js.map \ No newline at end of file diff --git a/Param0.js.map b/Param0.js.map new file mode 100644 index 0000000..9cadb5a --- /dev/null +++ b/Param0.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Param0.js","sourceRoot":"","sources":["src/Param0.ts"],"names":[],"mappings":";AAAA,uDAAuD"} \ No newline at end of file diff --git a/Parameters.d.ts b/Parameters.d.ts new file mode 100644 index 0000000..dfc7e7c --- /dev/null +++ b/Parameters.d.ts @@ -0,0 +1,2 @@ +/** https://docs.tsafe.dev/parameters */ +export type Parameters unknown) | null | undefined | false | ""> = T extends (...args: infer P) => any ? P : never; diff --git a/Parameters.js b/Parameters.js new file mode 100644 index 0000000..a266d95 --- /dev/null +++ b/Parameters.js @@ -0,0 +1,4 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Parameters.js.map \ No newline at end of file diff --git a/Parameters.js.map b/Parameters.js.map new file mode 100644 index 0000000..1a6a653 --- /dev/null +++ b/Parameters.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Parameters.js","sourceRoot":"","sources":["src/Parameters.ts"],"names":[],"mappings":";AAAA,uDAAuD"} \ No newline at end of file diff --git a/PickOptionals.d.ts b/PickOptionals.d.ts new file mode 100644 index 0000000..dac7923 --- /dev/null +++ b/PickOptionals.d.ts @@ -0,0 +1,10 @@ +type OptionalKeyof> = Exclude<{ + [Key in keyof T]: T extends Record ? never : Key; +}[keyof T], undefined>; +/** + * PickOptionals<{ p1: string; p2?: string; p3?: number; }> + * is the type + * { p2: string; p3: number; } + */ +export type PickOptionals> = Required>>; +export {}; diff --git a/PickOptionals.js b/PickOptionals.js new file mode 100644 index 0000000..9ec0b7c --- /dev/null +++ b/PickOptionals.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=PickOptionals.js.map \ No newline at end of file diff --git a/PickOptionals.js.map b/PickOptionals.js.map new file mode 100644 index 0000000..98d179e --- /dev/null +++ b/PickOptionals.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PickOptionals.js","sourceRoot":"","sources":["src/PickOptionals.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/PickRequired.d.ts b/PickRequired.d.ts new file mode 100644 index 0000000..72aaa23 --- /dev/null +++ b/PickRequired.d.ts @@ -0,0 +1,7 @@ +import { PickOptionals } from "./PickOptionals"; +/** + * PickRequired<{ p1: string; p2?: string; p3?: number; p4: string; }> + * is the type + * { p1: string; p4: number; } + */ +export type PickRequired> = Omit>; diff --git a/PickRequired.js b/PickRequired.js new file mode 100644 index 0000000..285609b --- /dev/null +++ b/PickRequired.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=PickRequired.js.map \ No newline at end of file diff --git a/PickRequired.js.map b/PickRequired.js.map new file mode 100644 index 0000000..97fbf94 --- /dev/null +++ b/PickRequired.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PickRequired.js","sourceRoot":"","sources":["src/PickRequired.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/Reflect.d.ts b/Reflect.d.ts new file mode 100644 index 0000000..fa64428 --- /dev/null +++ b/Reflect.d.ts @@ -0,0 +1,2 @@ +/** Always return null but pretends it returns an object of type T */ +export declare function Reflect(): T; diff --git a/Reflect.js b/Reflect.js new file mode 100644 index 0000000..30141aa --- /dev/null +++ b/Reflect.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Reflect = void 0; +/** Always return null but pretends it returns an object of type T */ +function Reflect() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return null; +} +exports.Reflect = Reflect; +//# sourceMappingURL=Reflect.js.map \ No newline at end of file diff --git a/Reflect.js.map b/Reflect.js.map new file mode 100644 index 0000000..6043ac0 --- /dev/null +++ b/Reflect.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Reflect.js","sourceRoot":"","sources":["src/Reflect.ts"],"names":[],"mappings":";;;AAAA,qEAAqE;AACrE,SAAgB,OAAO;IACnB,8DAA8D;IAC9D,OAAO,IAAW,CAAC;AACvB,CAAC;AAHD,0BAGC"} \ No newline at end of file diff --git a/ReturnType.d.ts b/ReturnType.d.ts new file mode 100644 index 0000000..0e00b32 --- /dev/null +++ b/ReturnType.d.ts @@ -0,0 +1,2 @@ +/** https://docs.tsafe.dev/returntype */ +export type ReturnType unknown) | undefined | null | false | ""> = T extends (...args: any[]) => infer R ? (R extends PromiseLike ? J : R) : never; diff --git a/ReturnType.js b/ReturnType.js new file mode 100644 index 0000000..bc4f657 --- /dev/null +++ b/ReturnType.js @@ -0,0 +1,10 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +// ReturnType<(()=> Promise | number) | undefined> = (()=> Promise | number) | undefined extends (...args: any[]) => infer R ? +// = ( ()=> Promise | number extends (...args: any[]) => infer R ? ) | (undefined extends (...args: any[]) => infer R ? ) +// = ( Promise | number extends PromiseLike ? ) | never +// = Promise | number extends PromiseLike ? +// = ( Promise extends PromiseLike ?) | ( number extends PromiseLike ?) +// = string | number +//# sourceMappingURL=ReturnType.js.map \ No newline at end of file diff --git a/ReturnType.js.map b/ReturnType.js.map new file mode 100644 index 0000000..9f2eee4 --- /dev/null +++ b/ReturnType.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ReturnType.js","sourceRoot":"","sources":["src/ReturnType.ts"],"names":[],"mappings":";AAAA,uDAAuD;;AAMvD,8IAA8I;AAC9I,yLAAyL;AACzL,4IAA4I;AAC5I,sHAAsH;AACtH,2JAA2J;AAC3J,0HAA0H"} \ No newline at end of file diff --git a/UnionToIntersection.d.ts b/UnionToIntersection.d.ts new file mode 100644 index 0000000..e1118a1 --- /dev/null +++ b/UnionToIntersection.d.ts @@ -0,0 +1,2 @@ +/** @see **/ +export type UnionToIntersection = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never; diff --git a/UnionToIntersection.js b/UnionToIntersection.js new file mode 100644 index 0000000..170258a --- /dev/null +++ b/UnionToIntersection.js @@ -0,0 +1,4 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=UnionToIntersection.js.map \ No newline at end of file diff --git a/UnionToIntersection.js.map b/UnionToIntersection.js.map new file mode 100644 index 0000000..5a0d490 --- /dev/null +++ b/UnionToIntersection.js.map @@ -0,0 +1 @@ +{"version":3,"file":"UnionToIntersection.js","sourceRoot":"","sources":["src/UnionToIntersection.ts"],"names":[],"mappings":";AAAA,uDAAuD"} \ No newline at end of file diff --git a/UnpackPromise.d.ts b/UnpackPromise.d.ts new file mode 100644 index 0000000..826dad4 --- /dev/null +++ b/UnpackPromise.d.ts @@ -0,0 +1,6 @@ +/** + * Use case: + * declare const pr: Promise; + * const x: UnpackPromise; <== x is string[] + */ +export type UnpackPromise | undefined | null | false | ""> = T extends PromiseLike ? U : never; diff --git a/UnpackPromise.js b/UnpackPromise.js new file mode 100644 index 0000000..4bbbe90 --- /dev/null +++ b/UnpackPromise.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=UnpackPromise.js.map \ No newline at end of file diff --git a/UnpackPromise.js.map b/UnpackPromise.js.map new file mode 100644 index 0000000..d2135b6 --- /dev/null +++ b/UnpackPromise.js.map @@ -0,0 +1 @@ +{"version":3,"file":"UnpackPromise.js","sourceRoot":"","sources":["src/UnpackPromise.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/assert.d.ts b/assert.d.ts new file mode 100644 index 0000000..0b5948f --- /dev/null +++ b/assert.d.ts @@ -0,0 +1,7 @@ +export type { Equals } from "./Equals"; +/** @see */ +export declare class AssertionError extends Error { + constructor(msg: string | undefined); +} +/** https://docs.tsafe.dev/assert */ +export declare function assert<_T extends true>(condition?: any, msg?: string): asserts condition; diff --git a/assert.js b/assert.js new file mode 100644 index 0000000..37b0a4d --- /dev/null +++ b/assert.js @@ -0,0 +1,83 @@ +"use strict"; +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + if (typeof b !== "function" && b !== null) + throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.assert = exports.AssertionError = void 0; +/* eslint-disable @typescript-eslint/no-unused-vars */ +var overwriteReadonlyProp_1 = require("./lab/overwriteReadonlyProp"); +var assertIsRefWrapper_1 = require("./zz_internal/assertIsRefWrapper"); +/** @see */ +var AssertionError = /** @class */ (function (_super) { + __extends(AssertionError, _super); + function AssertionError(msg) { + var _newTarget = this.constructor; + var _this = _super.call(this, "Wrong assertion encountered" + (!msg ? "" : ": \"".concat(msg, "\""))) || this; + Object.setPrototypeOf(_this, _newTarget.prototype); + if (!_this.stack) { + return _this; + } + try { + (0, overwriteReadonlyProp_1.overwriteReadonlyProp)(_this, "stack", _this.stack + .split("\n") + .filter(function () { + var _a = []; + for (var _i = 0; _i < arguments.length; _i++) { + _a[_i] = arguments[_i]; + } + var _b = __read(_a, 2), i = _b[1]; + return i !== 1 && i !== 2; + }) + .join("\n")); + // eslint-disable-next-line no-empty + } + catch (_a) { } + return _this; + } + return AssertionError; +}(Error)); +exports.AssertionError = AssertionError; +/** https://docs.tsafe.dev/assert */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function assert(condition, msg) { + if (arguments.length === 0) { + condition = true; + } + if (assertIsRefWrapper_1.assertIsRefWrapper.ref !== undefined) { + assertIsRefWrapper_1.assertIsRefWrapper.ref = undefined; + return; + } + if (!condition) { + throw new AssertionError(msg); + } +} +exports.assert = assert; +//# sourceMappingURL=assert.js.map \ No newline at end of file diff --git a/assert.js.map b/assert.js.map new file mode 100644 index 0000000..377185f --- /dev/null +++ b/assert.js.map @@ -0,0 +1 @@ +{"version":3,"file":"assert.js","sourceRoot":"","sources":["src/assert.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAsD;AACtD,qEAAoE;AACpE,uEAAsE;AAGtE,wDAAwD;AACxD;IAAoC,kCAAK;IACrC,wBAAY,GAAuB;;QAAnC,YACI,kBAAM,6BAA6B,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAM,GAAG,OAAG,CAAC,CAAC,SAmBpE;QAjBG,MAAM,CAAC,cAAc,CAAC,KAAI,EAAE,WAAW,SAAS,CAAC,CAAC;QAElD,IAAI,CAAC,KAAI,CAAC,KAAK,EAAE;;SAEhB;QAED,IAAI;YACA,IAAA,6CAAqB,EACjB,KAAI,EACJ,OAAO,EACP,KAAI,CAAC,KAAK;iBACL,KAAK,CAAC,IAAI,CAAC;iBACX,MAAM,CAAC;gBAAC,YAAQ;qBAAR,UAAQ,EAAR,qBAAQ,EAAR,IAAQ;oBAAR,uBAAQ;;gBAAR,IAAA,KAAA,aAAQ,EAAF,CAAC,QAAA,CAAC;gBAAK,OAAA,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC;YAAlB,CAAkB,CAAC;iBACxC,IAAI,CAAC,IAAI,CAAC,CAClB,CAAC;YACF,oCAAoC;SACvC;QAAC,WAAM,GAAE;;IACd,CAAC;IACL,qBAAC;AAAD,CAAC,AAtBD,CAAoC,KAAK,GAsBxC;AAtBY,wCAAc;AAwB3B,oCAAoC;AACpC,8DAA8D;AAC9D,SAAgB,MAAM,CAAkB,SAAe,EAAE,GAAY;IACjE,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,SAAS,GAAG,IAAI,CAAC;KACpB;IACD,IAAI,uCAAkB,CAAC,GAAG,KAAK,SAAS,EAAE;QACtC,uCAAkB,CAAC,GAAG,GAAG,SAAS,CAAC;QACnC,OAAO;KACV;IAED,IAAI,CAAC,SAAS,EAAE;QACZ,MAAM,IAAI,cAAc,CAAC,GAAG,CAAC,CAAC;KACjC;AACL,CAAC;AAZD,wBAYC"} \ No newline at end of file diff --git a/capitalize.d.ts b/capitalize.d.ts new file mode 100644 index 0000000..cbd5235 --- /dev/null +++ b/capitalize.d.ts @@ -0,0 +1,2 @@ +/** @see */ +export declare function capitalize(str: S): Capitalize; diff --git a/capitalize.js b/capitalize.js new file mode 100644 index 0000000..cdb4e57 --- /dev/null +++ b/capitalize.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.capitalize = void 0; +/** @see */ +function capitalize(str) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (str.charAt(0).toUpperCase() + str.slice(1)); +} +exports.capitalize = capitalize; +//# sourceMappingURL=capitalize.js.map \ No newline at end of file diff --git a/capitalize.js.map b/capitalize.js.map new file mode 100644 index 0000000..f71d34c --- /dev/null +++ b/capitalize.js.map @@ -0,0 +1 @@ +{"version":3,"file":"capitalize.js","sourceRoot":"","sources":["src/capitalize.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,SAAgB,UAAU,CAAmB,GAAM;IAC/C,8DAA8D;IAC9D,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAQ,CAAC;AAC/D,CAAC;AAHD,gCAGC"} \ No newline at end of file diff --git a/deno_dist/Equals.ts b/deno_dist/Equals.ts new file mode 100644 index 0000000..316f4cb --- /dev/null +++ b/deno_dist/Equals.ts @@ -0,0 +1,8 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import type { Unite } from "./tools/Unite.ts"; +import type { StrictEquals } from "./tools/StrictEquals.ts"; + +/** https://docs.tsafe.dev/main/equals */ +export type Equals = StrictEquals, Unite>; + +// Credit https://stackoverflow.com/a/52473108/3570903 diff --git a/deno_dist/Extends.ts b/deno_dist/Extends.ts new file mode 100644 index 0000000..568f25d --- /dev/null +++ b/deno_dist/Extends.ts @@ -0,0 +1,23 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { StrictEquals } from "./tools/StrictEquals.ts"; + +/** + * @see + * + * Usage example: assert>(); + **/ +export type Extends = StrictEquals extends true + ? true + : StrictEquals extends true + ? false + : StrictEquals extends true + ? true + : StrictEquals extends true + ? true + : StrictEquals extends true + ? false + : StrictEquals extends true + ? false + : A1 extends A2 + ? true + : false; diff --git a/deno_dist/LICENSE b/deno_dist/LICENSE new file mode 100644 index 0000000..61f220f --- /dev/null +++ b/deno_dist/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 GitHub user u/garronej + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/deno_dist/MethodNames.ts b/deno_dist/MethodNames.ts new file mode 100644 index 0000000..c7b0b26 --- /dev/null +++ b/deno_dist/MethodNames.ts @@ -0,0 +1,9 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/ban-types */ + +/** https://docs.tsafe.dev/methodnames */ +export type MethodNames = NonNullable< + { + [Key in keyof Api]: Api[Key] extends ((...args: any[]) => unknown) | undefined ? Key : never; + }[keyof Api] +>; diff --git a/deno_dist/Not.ts b/deno_dist/Not.ts new file mode 100644 index 0000000..c5bd642 --- /dev/null +++ b/deno_dist/Not.ts @@ -0,0 +1,2 @@ +/** https://docs.tsafe.dev/main/not */ +export type Not = B extends true ? false : true; diff --git a/deno_dist/Param0.ts b/deno_dist/Param0.ts new file mode 100644 index 0000000..284c847 --- /dev/null +++ b/deno_dist/Param0.ts @@ -0,0 +1,14 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import type { Parameters } from "./Parameters.ts"; + +type NonUndefined = T extends undefined ? never : T; + +/** Shorthand for Parameters[0] https://docs.tsafe.dev/param0 */ +export type Param0 unknown) | null | undefined | false | ""> = [ + Parameters, +] extends [never] + ? never + : Parameters extends [] + ? void + : NonUndefined[0]>; diff --git a/deno_dist/Parameters.ts b/deno_dist/Parameters.ts new file mode 100644 index 0000000..da900d6 --- /dev/null +++ b/deno_dist/Parameters.ts @@ -0,0 +1,5 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +/** https://docs.tsafe.dev/parameters */ +export type Parameters unknown) | null | undefined | false | ""> = + T extends (...args: infer P) => any ? P : never; diff --git a/deno_dist/PickOptionals.ts b/deno_dist/PickOptionals.ts new file mode 100644 index 0000000..048bd95 --- /dev/null +++ b/deno_dist/PickOptionals.ts @@ -0,0 +1,13 @@ +type OptionalKeyof> = Exclude< + { + [Key in keyof T]: T extends Record ? never : Key; + }[keyof T], + undefined +>; + +/** + * PickOptionals<{ p1: string; p2?: string; p3?: number; }> + * is the type + * { p2: string; p3: number; } + */ +export type PickOptionals> = Required>>; diff --git a/deno_dist/PickRequired.ts b/deno_dist/PickRequired.ts new file mode 100644 index 0000000..2a37d0a --- /dev/null +++ b/deno_dist/PickRequired.ts @@ -0,0 +1,8 @@ +import { PickOptionals } from "./PickOptionals.ts"; + +/** + * PickRequired<{ p1: string; p2?: string; p3?: number; p4: string; }> + * is the type + * { p1: string; p4: number; } + */ +export type PickRequired> = Omit>; diff --git a/deno_dist/README.md b/deno_dist/README.md new file mode 100644 index 0000000..ecc101b --- /dev/null +++ b/deno_dist/README.md @@ -0,0 +1,119 @@ +

+ +

+

+ A collection of utilities to take your TypeScript development up a notch +
+
+ + + + + + + + + + + + +
+ + + + (you can cherrypick what you import) +

+

+ Documentation +

+ +## A few GIFs to convince you that you need `tsafe` in your life + +

+
+ Assert things you know are true, get runtime errors where you were wrong: +
+
+ +

+

+
+
+ Implement compile time unit testing +
+
+ +
+ +
+ Playground +

+

+
+
+ Make sure all properties of an object are deconstructed +
+
+ +
+ Playground +

+

+
+
+ Make sure you never forget a case in a switch +
+
+ +
+ Playground +

+ +

+
+
+ Make TypeScript believe whatever you say without having to write const obj2 = obj as Bar. +
+ The more powerfully is to be able to tell TypeScript that obj ist not of type Bar: +
+
+ +

+ +

+
+
+ Make sure your zod schema exactly matches a given type: +
+ +

+ +## Motivations + +Powerful TypeScript features like [assertion functions](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions) or [user-defined type guards](https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards) are only useful if paired with utility functions. + +TypeScript, however, only exports type helpers \(e.g. `Record`, `ReturnType`, etc.\). + +This module provides _«the missing builtins»_ such as [the assert function](https://docs.tsafe.dev/assert) +and corrects frustrating aspects of default utility types such as [`ReturnType`](https://docs.tsafe.dev/returntype). + +[**Documentation website**](https://docs.tsafe.dev) + +## Installation + +`tsafe` is both an [NPM](https://www.npmjs.com/package/tsafe) and a [Deno](https://deno.land/x/tsafe) module. +(Achieved with [denoify](https://github.com/garronej/denoify)) + +## Import in deno: + +```typescript +import { assert, typeGuard, ... } from "https://deno.land/x/tsafe/mod.ts"; +``` + +## Install elsewhere: + +```bash +$ npm install --save tsafe +#OR +$ yarn add tsafe +``` diff --git a/deno_dist/Reflect.ts b/deno_dist/Reflect.ts new file mode 100644 index 0000000..d7e7dca --- /dev/null +++ b/deno_dist/Reflect.ts @@ -0,0 +1,5 @@ +/** Always return null but pretends it returns an object of type T */ +export function Reflect(): T { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return null as any; +} diff --git a/deno_dist/ReturnType.ts b/deno_dist/ReturnType.ts new file mode 100644 index 0000000..ddad4d3 --- /dev/null +++ b/deno_dist/ReturnType.ts @@ -0,0 +1,12 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +/** https://docs.tsafe.dev/returntype */ +export type ReturnType unknown) | undefined | null | false | ""> = + T extends (...args: any[]) => infer R ? (R extends PromiseLike ? J : R) : never; + +// ReturnType<(()=> Promise | number) | undefined> = (()=> Promise | number) | undefined extends (...args: any[]) => infer R ? +// = ( ()=> Promise | number extends (...args: any[]) => infer R ? ) | (undefined extends (...args: any[]) => infer R ? ) +// = ( Promise | number extends PromiseLike ? ) | never +// = Promise | number extends PromiseLike ? +// = ( Promise extends PromiseLike ?) | ( number extends PromiseLike ?) +// = string | number diff --git a/deno_dist/UnionToIntersection.ts b/deno_dist/UnionToIntersection.ts new file mode 100644 index 0000000..5582342 --- /dev/null +++ b/deno_dist/UnionToIntersection.ts @@ -0,0 +1,8 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +/** @see **/ +export type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ( + k: infer I, +) => void + ? I + : never; diff --git a/deno_dist/UnpackPromise.ts b/deno_dist/UnpackPromise.ts new file mode 100644 index 0000000..3d2ae2c --- /dev/null +++ b/deno_dist/UnpackPromise.ts @@ -0,0 +1,7 @@ +/** + * Use case: + * declare const pr: Promise; + * const x: UnpackPromise; <== x is string[] + */ +export type UnpackPromise | undefined | null | false | ""> = + T extends PromiseLike ? U : never; diff --git a/deno_dist/assert.ts b/deno_dist/assert.ts new file mode 100644 index 0000000..e811a3c --- /dev/null +++ b/deno_dist/assert.ts @@ -0,0 +1,45 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +import { overwriteReadonlyProp } from "./lab/overwriteReadonlyProp.ts"; +import { assertIsRefWrapper } from "./zz_internal/assertIsRefWrapper.ts"; +export type { Equals } from "./Equals.ts"; + +/** @see */ +export class AssertionError extends Error { + constructor(msg: string | undefined) { + super(`Wrong assertion encountered` + (!msg ? "" : `: "${msg}"`)); + + Object.setPrototypeOf(this, new.target.prototype); + + if (!this.stack) { + return; + } + + try { + overwriteReadonlyProp( + this, + "stack", + this.stack + .split("\n") + .filter((...[, i]) => i !== 1 && i !== 2) + .join("\n"), + ); + // eslint-disable-next-line no-empty + } catch {} + } +} + +/** https://docs.tsafe.dev/assert */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function assert<_T extends true>(condition?: any, msg?: string): asserts condition { + if (arguments.length === 0) { + condition = true; + } + if (assertIsRefWrapper.ref !== undefined) { + assertIsRefWrapper.ref = undefined; + return; + } + + if (!condition) { + throw new AssertionError(msg); + } +} diff --git a/deno_dist/capitalize.ts b/deno_dist/capitalize.ts new file mode 100644 index 0000000..b29fce6 --- /dev/null +++ b/deno_dist/capitalize.ts @@ -0,0 +1,5 @@ +/** @see */ +export function capitalize(str: S): Capitalize { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (str.charAt(0).toUpperCase() + str.slice(1)) as any; +} diff --git a/deno_dist/exclude.ts b/deno_dist/exclude.ts new file mode 100644 index 0000000..8c4b7be --- /dev/null +++ b/deno_dist/exclude.ts @@ -0,0 +1,19 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +/** Return a function to use as Array.prototype.filter argument + * to exclude one or many primitive value element from the array. + * Ex: ([ "a", "b", "c" ] as const).filter(exclude("a")) return ("b" | "c")[] + * Ex: ([ "a", "b", "c", "d"] as const).filter(exclude(["a", "b"]) gives ("c" | "d")[] + */ +export function exclude( + target: readonly T[] | T, +) { + const test: (element: any) => boolean = + target instanceof Object + ? element => target.indexOf(element) < 0 + : element => element !== target; + + return function (str: U): str is Exclude { + return test(str); + }; +} diff --git a/deno_dist/flip.ts b/deno_dist/flip.ts new file mode 100644 index 0000000..96940f3 --- /dev/null +++ b/deno_dist/flip.ts @@ -0,0 +1,20 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +type KeyOfType, U> = NonNullable< + { + [Key in keyof T]: T[Key] extends U | undefined ? Key : never; + }[keyof T] +>; + +/** + * Flip the value of a boolean without having to reference it twice + * after running flip(x.y, "z") x.y.z !== x.y.z, + * https://docs.tsafe.dev/flip + */ +export function flip>(object: T, prop: KeyOfType) { + if (object[prop] === undefined) { + return; + } + + return (object[prop] = !object[prop] as any); +} diff --git a/deno_dist/id.ts b/deno_dist/id.ts new file mode 100644 index 0000000..9d202e3 --- /dev/null +++ b/deno_dist/id.ts @@ -0,0 +1,37 @@ +/** https://docs.tsafe.dev/id */ +export const id = (x: T) => x; + +/** + * Ensure that a that a specific type that we are declaring extends a more generic type + * + * Use case example 1: + * + * type MyObject = { + * p1: string; + * p2: string; + * a: string; + * b: string; + * }; + * + * We want to define a type that consist in an union of + * all the property name that are letters: + * + * type AlphabeticalKeys = Id; + * + * Here AlphabeticalKeys is "a" | "b" but it's better than + * simply writing it explicitly as we get autocompletion + * and we can't include a property name that does not exist on MyObject. + * + * Use case example 2: + * + * We want to declare object type that only take string or number + * as key value: + * + * export type MyObject = Id, { + * p1: string; + * p2: number; + * }>; + * + * If later on someone adds "p3": string[] he will get a type error. + * */ +export type Id = Specific; diff --git a/deno_dist/index.ts b/deno_dist/index.ts new file mode 100644 index 0000000..5134196 --- /dev/null +++ b/deno_dist/index.ts @@ -0,0 +1,25 @@ +export * from "./assert.ts"; +export * from "./exclude.ts"; +export * from "./flip.ts"; +export * from "./id.ts"; +export * from "./isPromiseLike.ts"; +export type { MethodNames } from "./MethodNames.ts"; +export * from "./objectKeys.ts"; +export type { Parameters } from "./Parameters.ts"; +export type { Param0 } from "./Param0.ts"; +export type { PickOptionals } from "./PickOptionals.ts"; +export type { PickRequired } from "./PickRequired.ts"; +export type { ReturnType } from "./ReturnType.ts"; +export * from "./typeGuard.ts"; +export type { UnpackPromise } from "./UnpackPromise.ts"; +export * from "./is.ts"; +export type { Equals } from "./Equals.ts"; +export type { Extends } from "./Extends.ts"; +export type { Not } from "./Not.ts"; +export type { UnionToIntersection } from "./UnionToIntersection.ts"; +export * from "./objectEntries.ts"; +export * from "./objectFromEntries.ts"; +export * from "./noUndefined.ts"; +export * from "./Reflect.ts"; +export * from "./capitalize.ts"; +export * from "./uncapitalize.ts"; diff --git a/deno_dist/is.ts b/deno_dist/is.ts new file mode 100644 index 0000000..042eea3 --- /dev/null +++ b/deno_dist/is.ts @@ -0,0 +1,28 @@ +/* eslint-disable @typescript-eslint/no-namespace */ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import { assertIsRefWrapper } from "./zz_internal/assertIsRefWrapper.ts"; + +const errorMessage = [ + `Wrong usage of the ${is.name} function refer to`, + `https://docs.tsafe.dev/${is.name.toLowerCase()}`, +].join(" "); + +export function is(_value: any): _value is T { + const ref = {}; + + if (assertIsRefWrapper.ref !== undefined) { + assertIsRefWrapper.ref = undefined; + throw new Error(errorMessage); + } + + assertIsRefWrapper.ref = ref; + + Promise.resolve().then(() => { + if (assertIsRefWrapper.ref === ref) { + throw new Error(errorMessage); + } + }); + + return null as any; +} diff --git a/deno_dist/isPromiseLike.ts b/deno_dist/isPromiseLike.ts new file mode 100644 index 0000000..fdd00a1 --- /dev/null +++ b/deno_dist/isPromiseLike.ts @@ -0,0 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function isPromiseLike(o: any): o is PromiseLike { + return typeof o?.then === "function"; +} diff --git a/deno_dist/lab/PromiseOrNot.ts b/deno_dist/lab/PromiseOrNot.ts new file mode 100644 index 0000000..5ad9139 --- /dev/null +++ b/deno_dist/lab/PromiseOrNot.ts @@ -0,0 +1 @@ +export type PromiseOrNot = PromiseLike | T; diff --git a/deno_dist/lab/UnpackTypeGuard.ts b/deno_dist/lab/UnpackTypeGuard.ts new file mode 100644 index 0000000..d6e90ea --- /dev/null +++ b/deno_dist/lab/UnpackTypeGuard.ts @@ -0,0 +1,5 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +export type UnpackTypeGuard o is unknown> = T extends (o: any) => o is infer U + ? U + : never; diff --git a/deno_dist/lab/defineAccessors.ts b/deno_dist/lab/defineAccessors.ts new file mode 100644 index 0000000..7fc7aa7 --- /dev/null +++ b/deno_dist/lab/defineAccessors.ts @@ -0,0 +1,31 @@ +export const defineAccessors = , K extends keyof T>( + obj: T, + propertyName: K, + propertyDescriptor: { + get?: () => T[K]; + set?: (value: T[K]) => void; + }, +): void => { + const { get, set } = propertyDescriptor; + + Object.defineProperty(obj, propertyName, { + ...(Object.getOwnPropertyDescriptor(obj, propertyName) || { + "enumerable": true, + "configurable": true, + }), + ...(get !== undefined + ? { + "get": function () { + return get.call(this); + }, + } + : {}), + ...(set !== undefined + ? { + "set": function (value: T[K]) { + set.call(this, value); + }, + } + : {}), + }); +}; diff --git a/deno_dist/lab/index.ts b/deno_dist/lab/index.ts new file mode 100644 index 0000000..f44eb08 --- /dev/null +++ b/deno_dist/lab/index.ts @@ -0,0 +1,5 @@ +export * from "./defineAccessors.ts"; +export * from "./overwriteReadonlyProp.ts"; +export * from "./PromiseOrNot.ts"; +export * from "./UnpackTypeGuard.ts"; +export * from "./withDefaults.ts"; diff --git a/deno_dist/lab/overwriteReadonlyProp.ts b/deno_dist/lab/overwriteReadonlyProp.ts new file mode 100644 index 0000000..b684d12 --- /dev/null +++ b/deno_dist/lab/overwriteReadonlyProp.ts @@ -0,0 +1,52 @@ +/* eslint-disable no-empty */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { assert } from "../assert.ts"; +import { is } from "../is.ts"; + +/** + * Assign a value to a property even if the object is freezed or if the property is not writable + * Throw if the assignation fail ( for example if the property is non configurable write: false ) + * */ +export const overwriteReadonlyProp = ( + obj: T, + propertyName: K, + value: T[K], +): T[K] => { + try { + obj[propertyName] = value; + } catch {} + + if (obj[propertyName] === value) { + return value; + } + + let errorDefineProperty: Error | undefined = undefined; + + const propertyDescriptor: PropertyDescriptor = Object.getOwnPropertyDescriptor( + obj, + propertyName, + ) || { + "enumerable": true, + "configurable": true, + }; + + if (!!propertyDescriptor.get) { + throw new Error(`Probably a wrong ides to overwrite ${String(propertyName)} getter`); + } + + try { + Object.defineProperty(obj, propertyName, { + ...propertyDescriptor, + value, + }); + } catch (error) { + assert(is(error)); + errorDefineProperty = error; + } + + if (obj[propertyName] !== value) { + throw errorDefineProperty || new Error("Can't assign"); + } + + return value; +}; diff --git a/deno_dist/lab/withDefaults.ts b/deno_dist/lab/withDefaults.ts new file mode 100644 index 0000000..00144e2 --- /dev/null +++ b/deno_dist/lab/withDefaults.ts @@ -0,0 +1,33 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import "../tools/Object.fromEntries.ts"; +/** + * Like Function.prototype.bind() but for a function that + * receives their parameters wrapped in an object. + * See documentation for more details: + * https://docs.tsafe.dev/withdefaults + */ +export function withDefaults, DefaultKey extends keyof Params, R>( + f: (params: Params) => R, + defaultParams: keyof Params extends never + ? Record + : { [Key in DefaultKey]: Params[Key] }, +): ( + params: { [Key in keyof Omit]: Params[Key] } & { + defaultsOverwrite?: { [Key in DefaultKey]?: [Params[Key]] }; + }, +) => R { + return params => { + const { defaultsOverwrite = {}, ...actualParams } = params; + + return f({ + ...defaultParams, + ...actualParams, + ...Object.fromEntries( + Object.entries(defaultsOverwrite) + .filter(([, value]) => value !== undefined) + .map(([key, value]) => [key, (value as any)[0]]), + ), + } as any); + }; +} diff --git a/deno_dist/mod.ts b/deno_dist/mod.ts new file mode 100644 index 0000000..da5ee32 --- /dev/null +++ b/deno_dist/mod.ts @@ -0,0 +1 @@ +export * from "./index.ts"; \ No newline at end of file diff --git a/deno_dist/noUndefined.ts b/deno_dist/noUndefined.ts new file mode 100644 index 0000000..d2d1012 --- /dev/null +++ b/deno_dist/noUndefined.ts @@ -0,0 +1,24 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/ban-types */ + +/** + * Removes the enumerable properties whose values are + * undefined. + * + * Example: + * noUndefined({ "foo": undefined, "bar": 3 }) returns + * a new object { "bar": 3 } + */ +export function noUndefined(obj: T): T { + const out: typeof obj = {} as any; + + for (const key in obj) { + if (obj[key] === undefined) { + continue; + } + + out[key] = obj[key]; + } + + return out; +} diff --git a/deno_dist/objectEntries.ts b/deno_dist/objectEntries.ts new file mode 100644 index 0000000..681211d --- /dev/null +++ b/deno_dist/objectEntries.ts @@ -0,0 +1,14 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +/** https://docs.tsafe.dev/objectentries */ +export function objectEntries>( + o: O, +): Exclude<{ [Key in keyof O]: [Key, O[Key]] }[keyof O], undefined>[] { + return Object.entries(o) as any; +} + +/** Return type of objectEntries https://docs.tsafe.dev/objectentries */ +export type ObjectEntries> = Exclude< + { [Key in keyof O]: [Key, O[Key]] }[keyof O], + undefined +>[]; diff --git a/deno_dist/objectFromEntries.ts b/deno_dist/objectFromEntries.ts new file mode 100644 index 0000000..8c060a0 --- /dev/null +++ b/deno_dist/objectFromEntries.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +/** https://docs.tsafe.dev/objectFromEntries */ +export function objectFromEntries( + entries: readonly Entry[], +): { [Key in Entry[0]]: Extract[1] } { + return Object.fromEntries(entries) as any; +} + +/** Return type of objectFromEntries https://docs.tsafe.dev/objectFromEntries */ +export type ObjectFromEntries = { + [Key in Entry[0]]: Extract[1]; +}; diff --git a/deno_dist/objectKeys.ts b/deno_dist/objectKeys.ts new file mode 100644 index 0000000..f732807 --- /dev/null +++ b/deno_dist/objectKeys.ts @@ -0,0 +1,6 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +/** https://docs.tsafe.dev/objectKeys */ +export function objectKeys>(o: T): (keyof T)[] { + return Object.keys(o) as any; +} diff --git a/deno_dist/symToStr.ts b/deno_dist/symToStr.ts new file mode 100644 index 0000000..333cfa9 --- /dev/null +++ b/deno_dist/symToStr.ts @@ -0,0 +1,4 @@ +/** @see */ +export function symToStr>(wrap: T): keyof T { + return Object.keys(wrap)[0]; +} diff --git a/deno_dist/tools/Object.fromEntries.ts b/deno_dist/tools/Object.fromEntries.ts new file mode 100644 index 0000000..dd31775 --- /dev/null +++ b/deno_dist/tools/Object.fromEntries.ts @@ -0,0 +1,23 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +if (!(Object as any).fromEntries) { + Object.defineProperty(Object, "fromEntries", { + "value": function (entries: any) { + if (!entries || !entries[Symbol.iterator]) { + throw new Error("Object.fromEntries() requires a single iterable argument"); + } + + const o: any = {}; + + Object.keys(entries).forEach(key => { + const [k, v] = entries[key]; + + o[k] = v; + }); + + return o; + }, + }); +} + +export {}; diff --git a/deno_dist/tools/StrictEquals.ts b/deno_dist/tools/StrictEquals.ts new file mode 100644 index 0000000..f6b5bfd --- /dev/null +++ b/deno_dist/tools/StrictEquals.ts @@ -0,0 +1,5 @@ +export type StrictEquals = (() => A extends A2 ? true : false) extends () => A extends A1 + ? true + : false + ? true + : false; diff --git a/deno_dist/tools/Unite.ts b/deno_dist/tools/Unite.ts new file mode 100644 index 0000000..fc3014e --- /dev/null +++ b/deno_dist/tools/Unite.ts @@ -0,0 +1 @@ +export type Unite = T extends Record ? { [Key in keyof T]: T[Key] } : T; diff --git a/deno_dist/tools/getProjectRoot.ts b/deno_dist/tools/getProjectRoot.ts new file mode 100644 index 0000000..6981ef2 --- /dev/null +++ b/deno_dist/tools/getProjectRoot.ts @@ -0,0 +1,45 @@ +const __dirname = (() => { + const { url: urlStr } = import.meta; + const url = new URL(urlStr); + const __filename = (url.protocol === "file:" ? url.pathname : urlStr) + .replace(/[/][^/]*$/, ''); + + const isWindows = (() => { + + let NATIVE_OS: typeof Deno.build.os = "linux"; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const navigator = (globalThis as any).navigator; + if (globalThis.Deno != null) { + NATIVE_OS = Deno.build.os; + } else if (navigator?.appVersion?.includes?.("Win") ?? false) { + NATIVE_OS = "windows"; + } + + return NATIVE_OS == "windows"; + + })(); + + return isWindows ? + __filename.split("/").join("\\").substring(1) : + __filename; +})(); + +import * as fs from "node:fs"; +import * as path from "node:path"; + +function getProjectRootRec(dirPath: string): string { + if (fs.existsSync(path.join(dirPath, "package.json"))) { + return dirPath; + } + return getProjectRootRec(path.join(dirPath, "..")); +} + +let result: string | undefined = undefined; + +export function getProjectRoot(): string { + if (result !== undefined) { + return result; + } + + return (result = getProjectRootRec(__dirname)); +} diff --git a/deno_dist/tools/index.ts b/deno_dist/tools/index.ts new file mode 100644 index 0000000..0983ef0 --- /dev/null +++ b/deno_dist/tools/index.ts @@ -0,0 +1,5 @@ +export * from "./getProjectRoot.ts"; +export * from "./Object.fromEntries.ts"; +export * from "./StrictEquals.ts"; +export * from "./toUpperCase.ts"; +export * from "./Unite.ts"; diff --git a/deno_dist/tools/toUpperCase.ts b/deno_dist/tools/toUpperCase.ts new file mode 100644 index 0000000..a4d5672 --- /dev/null +++ b/deno_dist/tools/toUpperCase.ts @@ -0,0 +1,3 @@ +export function toUpperCase(str: string): string { + return str.toUpperCase(); +} diff --git a/deno_dist/typeGuard.ts b/deno_dist/typeGuard.ts new file mode 100644 index 0000000..4e17714 --- /dev/null +++ b/deno_dist/typeGuard.ts @@ -0,0 +1,7 @@ +/* eslint-disable @typescript-eslint/no-namespace */ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +/** https://docs.tsafe.dev/typeguard */ +export function typeGuard(_value: any, isMatched: boolean): _value is T { + return isMatched; +} diff --git a/deno_dist/uncapitalize.ts b/deno_dist/uncapitalize.ts new file mode 100644 index 0000000..af14275 --- /dev/null +++ b/deno_dist/uncapitalize.ts @@ -0,0 +1,5 @@ +/** @see */ +export function uncapitalize(str: S): Uncapitalize { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (str.charAt(0).toLowerCase() + str.slice(1)) as any; +} diff --git a/deno_dist/zz_internal/assertIsRefWrapper.ts b/deno_dist/zz_internal/assertIsRefWrapper.ts new file mode 100644 index 0000000..39553fc --- /dev/null +++ b/deno_dist/zz_internal/assertIsRefWrapper.ts @@ -0,0 +1,5 @@ +import { id } from "../id.ts"; + +export const assertIsRefWrapper = { + "ref": id>(undefined), +}; diff --git a/exclude.d.ts b/exclude.d.ts new file mode 100644 index 0000000..909ca29 --- /dev/null +++ b/exclude.d.ts @@ -0,0 +1,6 @@ +/** Return a function to use as Array.prototype.filter argument + * to exclude one or many primitive value element from the array. + * Ex: ([ "a", "b", "c" ] as const).filter(exclude("a")) return ("b" | "c")[] + * Ex: ([ "a", "b", "c", "d"] as const).filter(exclude(["a", "b"]) gives ("c" | "d")[] + */ +export declare function exclude(target: readonly T[] | T): (str: U) => str is Exclude; diff --git a/exclude.js b/exclude.js new file mode 100644 index 0000000..eaa1ebf --- /dev/null +++ b/exclude.js @@ -0,0 +1,19 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.exclude = void 0; +/** Return a function to use as Array.prototype.filter argument + * to exclude one or many primitive value element from the array. + * Ex: ([ "a", "b", "c" ] as const).filter(exclude("a")) return ("b" | "c")[] + * Ex: ([ "a", "b", "c", "d"] as const).filter(exclude(["a", "b"]) gives ("c" | "d")[] + */ +function exclude(target) { + var test = target instanceof Object + ? function (element) { return target.indexOf(element) < 0; } + : function (element) { return element !== target; }; + return function (str) { + return test(str); + }; +} +exports.exclude = exclude; +//# sourceMappingURL=exclude.js.map \ No newline at end of file diff --git a/exclude.js.map b/exclude.js.map new file mode 100644 index 0000000..bbc1914 --- /dev/null +++ b/exclude.js.map @@ -0,0 +1 @@ +{"version":3,"file":"exclude.js","sourceRoot":"","sources":["src/exclude.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;AAEvD;;;;GAIG;AACH,SAAgB,OAAO,CACnB,MAAwB;IAExB,IAAM,IAAI,GACN,MAAM,YAAY,MAAM;QACpB,CAAC,CAAC,UAAA,OAAO,IAAI,OAAA,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,EAA3B,CAA2B;QACxC,CAAC,CAAC,UAAA,OAAO,IAAI,OAAA,OAAO,KAAK,MAAM,EAAlB,CAAkB,CAAC;IAExC,OAAO,UAAa,GAAM;QACtB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;IACrB,CAAC,CAAC;AACN,CAAC;AAXD,0BAWC"} \ No newline at end of file diff --git a/flip.d.ts b/flip.d.ts new file mode 100644 index 0000000..54c63f2 --- /dev/null +++ b/flip.d.ts @@ -0,0 +1,10 @@ +type KeyOfType, U> = NonNullable<{ + [Key in keyof T]: T[Key] extends U | undefined ? Key : never; +}[keyof T]>; +/** + * Flip the value of a boolean without having to reference it twice + * after running flip(x.y, "z") x.y.z !== x.y.z, + * https://docs.tsafe.dev/flip + */ +export declare function flip>(object: T, prop: KeyOfType): any; +export {}; diff --git a/flip.js b/flip.js new file mode 100644 index 0000000..5d065b4 --- /dev/null +++ b/flip.js @@ -0,0 +1,17 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.flip = void 0; +/** + * Flip the value of a boolean without having to reference it twice + * after running flip(x.y, "z") x.y.z !== x.y.z, + * https://docs.tsafe.dev/flip + */ +function flip(object, prop) { + if (object[prop] === undefined) { + return; + } + return (object[prop] = !object[prop]); +} +exports.flip = flip; +//# sourceMappingURL=flip.js.map \ No newline at end of file diff --git a/flip.js.map b/flip.js.map new file mode 100644 index 0000000..5439ad2 --- /dev/null +++ b/flip.js.map @@ -0,0 +1 @@ +{"version":3,"file":"flip.js","sourceRoot":"","sources":["src/flip.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;AAQvD;;;;GAIG;AACH,SAAgB,IAAI,CAAgC,MAAS,EAAE,IAA2B;IACtF,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE;QAC5B,OAAO;KACV;IAED,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAQ,CAAC,CAAC;AACjD,CAAC;AAND,oBAMC"} \ No newline at end of file diff --git a/id.d.ts b/id.d.ts new file mode 100644 index 0000000..e3e6d46 --- /dev/null +++ b/id.d.ts @@ -0,0 +1,36 @@ +/** https://docs.tsafe.dev/id */ +export declare const id: (x: T) => T; +/** + * Ensure that a that a specific type that we are declaring extends a more generic type + * + * Use case example 1: + * + * type MyObject = { + * p1: string; + * p2: string; + * a: string; + * b: string; + * }; + * + * We want to define a type that consist in an union of + * all the property name that are letters: + * + * type AlphabeticalKeys = Id; + * + * Here AlphabeticalKeys is "a" | "b" but it's better than + * simply writing it explicitly as we get autocompletion + * and we can't include a property name that does not exist on MyObject. + * + * Use case example 2: + * + * We want to declare object type that only take string or number + * as key value: + * + * export type MyObject = Id, { + * p1: string; + * p2: number; + * }>; + * + * If later on someone adds "p3": string[] he will get a type error. + * */ +export type Id = Specific; diff --git a/id.js b/id.js new file mode 100644 index 0000000..e4c2976 --- /dev/null +++ b/id.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.id = void 0; +/** https://docs.tsafe.dev/id */ +var id = function (x) { return x; }; +exports.id = id; +//# sourceMappingURL=id.js.map \ No newline at end of file diff --git a/id.js.map b/id.js.map new file mode 100644 index 0000000..f7f4697 --- /dev/null +++ b/id.js.map @@ -0,0 +1 @@ +{"version":3,"file":"id.js","sourceRoot":"","sources":["src/id.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AAC1B,IAAM,EAAE,GAAG,UAAI,CAAI,IAAK,OAAA,CAAC,EAAD,CAAC,CAAC;AAApB,QAAA,EAAE,MAAkB"} \ No newline at end of file diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..a0d7f36 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,25 @@ +export * from "./assert"; +export * from "./exclude"; +export * from "./flip"; +export * from "./id"; +export * from "./isPromiseLike"; +export type { MethodNames } from "./MethodNames"; +export * from "./objectKeys"; +export type { Parameters } from "./Parameters"; +export type { Param0 } from "./Param0"; +export type { PickOptionals } from "./PickOptionals"; +export type { PickRequired } from "./PickRequired"; +export type { ReturnType } from "./ReturnType"; +export * from "./typeGuard"; +export type { UnpackPromise } from "./UnpackPromise"; +export * from "./is"; +export type { Equals } from "./Equals"; +export type { Extends } from "./Extends"; +export type { Not } from "./Not"; +export type { UnionToIntersection } from "./UnionToIntersection"; +export * from "./objectEntries"; +export * from "./objectFromEntries"; +export * from "./noUndefined"; +export * from "./Reflect"; +export * from "./capitalize"; +export * from "./uncapitalize"; diff --git a/index.js b/index.js new file mode 100644 index 0000000..2895174 --- /dev/null +++ b/index.js @@ -0,0 +1,31 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./assert"), exports); +__exportStar(require("./exclude"), exports); +__exportStar(require("./flip"), exports); +__exportStar(require("./id"), exports); +__exportStar(require("./isPromiseLike"), exports); +__exportStar(require("./objectKeys"), exports); +__exportStar(require("./typeGuard"), exports); +__exportStar(require("./is"), exports); +__exportStar(require("./objectEntries"), exports); +__exportStar(require("./objectFromEntries"), exports); +__exportStar(require("./noUndefined"), exports); +__exportStar(require("./Reflect"), exports); +__exportStar(require("./capitalize"), exports); +__exportStar(require("./uncapitalize"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/index.js.map b/index.js.map new file mode 100644 index 0000000..0e3db43 --- /dev/null +++ b/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,4CAA0B;AAC1B,yCAAuB;AACvB,uCAAqB;AACrB,kDAAgC;AAEhC,+CAA6B;AAM7B,8CAA4B;AAE5B,uCAAqB;AAKrB,kDAAgC;AAChC,sDAAoC;AACpC,gDAA8B;AAC9B,4CAA0B;AAC1B,+CAA6B;AAC7B,iDAA+B"} \ No newline at end of file diff --git a/is.d.ts b/is.d.ts new file mode 100644 index 0000000..076cac5 --- /dev/null +++ b/is.d.ts @@ -0,0 +1 @@ +export declare function is(_value: any): _value is T; diff --git a/is.js b/is.js new file mode 100644 index 0000000..b2cedce --- /dev/null +++ b/is.js @@ -0,0 +1,26 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-namespace */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.is = void 0; +var assertIsRefWrapper_1 = require("./zz_internal/assertIsRefWrapper"); +var errorMessage = [ + "Wrong usage of the ".concat(is.name, " function refer to"), + "https://docs.tsafe.dev/".concat(is.name.toLowerCase()), +].join(" "); +function is(_value) { + var ref = {}; + if (assertIsRefWrapper_1.assertIsRefWrapper.ref !== undefined) { + assertIsRefWrapper_1.assertIsRefWrapper.ref = undefined; + throw new Error(errorMessage); + } + assertIsRefWrapper_1.assertIsRefWrapper.ref = ref; + Promise.resolve().then(function () { + if (assertIsRefWrapper_1.assertIsRefWrapper.ref === ref) { + throw new Error(errorMessage); + } + }); + return null; +} +exports.is = is; +//# sourceMappingURL=is.js.map \ No newline at end of file diff --git a/is.js.map b/is.js.map new file mode 100644 index 0000000..45b9e66 --- /dev/null +++ b/is.js.map @@ -0,0 +1 @@ +{"version":3,"file":"is.js","sourceRoot":"","sources":["src/is.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,uDAAuD;;;AAEvD,uEAAsE;AAEtE,IAAM,YAAY,GAAG;IACjB,6BAAsB,EAAE,CAAC,IAAI,uBAAoB;IACjD,iCAA0B,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,CAAE;CACpD,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEZ,SAAgB,EAAE,CAAI,MAAW;IAC7B,IAAM,GAAG,GAAG,EAAE,CAAC;IAEf,IAAI,uCAAkB,CAAC,GAAG,KAAK,SAAS,EAAE;QACtC,uCAAkB,CAAC,GAAG,GAAG,SAAS,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;KACjC;IAED,uCAAkB,CAAC,GAAG,GAAG,GAAG,CAAC;IAE7B,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC;QACnB,IAAI,uCAAkB,CAAC,GAAG,KAAK,GAAG,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;SACjC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,IAAW,CAAC;AACvB,CAAC;AAjBD,gBAiBC"} \ No newline at end of file diff --git a/isPromiseLike.d.ts b/isPromiseLike.d.ts new file mode 100644 index 0000000..e881cb9 --- /dev/null +++ b/isPromiseLike.d.ts @@ -0,0 +1 @@ +export declare function isPromiseLike(o: any): o is PromiseLike; diff --git a/isPromiseLike.js b/isPromiseLike.js new file mode 100644 index 0000000..f39295a --- /dev/null +++ b/isPromiseLike.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isPromiseLike = void 0; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function isPromiseLike(o) { + return typeof (o === null || o === void 0 ? void 0 : o.then) === "function"; +} +exports.isPromiseLike = isPromiseLike; +//# sourceMappingURL=isPromiseLike.js.map \ No newline at end of file diff --git a/isPromiseLike.js.map b/isPromiseLike.js.map new file mode 100644 index 0000000..4d13d01 --- /dev/null +++ b/isPromiseLike.js.map @@ -0,0 +1 @@ +{"version":3,"file":"isPromiseLike.js","sourceRoot":"","sources":["src/isPromiseLike.ts"],"names":[],"mappings":";;;AAAA,8DAA8D;AAC9D,SAAgB,aAAa,CAAW,CAAM;IAC1C,OAAO,OAAO,CAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,IAAI,CAAA,KAAK,UAAU,CAAC;AACzC,CAAC;AAFD,sCAEC"} \ No newline at end of file diff --git a/lab/PromiseOrNot.d.ts b/lab/PromiseOrNot.d.ts new file mode 100644 index 0000000..5ad9139 --- /dev/null +++ b/lab/PromiseOrNot.d.ts @@ -0,0 +1 @@ +export type PromiseOrNot = PromiseLike | T; diff --git a/lab/PromiseOrNot.js b/lab/PromiseOrNot.js new file mode 100644 index 0000000..206c5b9 --- /dev/null +++ b/lab/PromiseOrNot.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=PromiseOrNot.js.map \ No newline at end of file diff --git a/lab/PromiseOrNot.js.map b/lab/PromiseOrNot.js.map new file mode 100644 index 0000000..e203d42 --- /dev/null +++ b/lab/PromiseOrNot.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PromiseOrNot.js","sourceRoot":"","sources":["../src/lab/PromiseOrNot.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lab/UnpackTypeGuard.d.ts b/lab/UnpackTypeGuard.d.ts new file mode 100644 index 0000000..af4fc37 --- /dev/null +++ b/lab/UnpackTypeGuard.d.ts @@ -0,0 +1 @@ +export type UnpackTypeGuard o is unknown> = T extends (o: any) => o is infer U ? U : never; diff --git a/lab/UnpackTypeGuard.js b/lab/UnpackTypeGuard.js new file mode 100644 index 0000000..d72952f --- /dev/null +++ b/lab/UnpackTypeGuard.js @@ -0,0 +1,4 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=UnpackTypeGuard.js.map \ No newline at end of file diff --git a/lab/UnpackTypeGuard.js.map b/lab/UnpackTypeGuard.js.map new file mode 100644 index 0000000..314c53e --- /dev/null +++ b/lab/UnpackTypeGuard.js.map @@ -0,0 +1 @@ +{"version":3,"file":"UnpackTypeGuard.js","sourceRoot":"","sources":["../src/lab/UnpackTypeGuard.ts"],"names":[],"mappings":";AAAA,uDAAuD"} \ No newline at end of file diff --git a/lab/defineAccessors.d.ts b/lab/defineAccessors.d.ts new file mode 100644 index 0000000..0b07e45 --- /dev/null +++ b/lab/defineAccessors.d.ts @@ -0,0 +1,4 @@ +export declare const defineAccessors: , K extends keyof T>(obj: T, propertyName: K, propertyDescriptor: { + get?: (() => T[K]) | undefined; + set?: ((value: T[K]) => void) | undefined; +}) => void; diff --git a/lab/defineAccessors.js b/lab/defineAccessors.js new file mode 100644 index 0000000..10a67d8 --- /dev/null +++ b/lab/defineAccessors.js @@ -0,0 +1,35 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.defineAccessors = void 0; +var defineAccessors = function (obj, propertyName, propertyDescriptor) { + var get = propertyDescriptor.get, set = propertyDescriptor.set; + Object.defineProperty(obj, propertyName, __assign(__assign(__assign({}, (Object.getOwnPropertyDescriptor(obj, propertyName) || { + "enumerable": true, + "configurable": true, + })), (get !== undefined + ? { + "get": function () { + return get.call(this); + }, + } + : {})), (set !== undefined + ? { + "set": function (value) { + set.call(this, value); + }, + } + : {}))); +}; +exports.defineAccessors = defineAccessors; +//# sourceMappingURL=defineAccessors.js.map \ No newline at end of file diff --git a/lab/defineAccessors.js.map b/lab/defineAccessors.js.map new file mode 100644 index 0000000..7875dd4 --- /dev/null +++ b/lab/defineAccessors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"defineAccessors.js","sourceRoot":"","sources":["../src/lab/defineAccessors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAO,IAAM,eAAe,GAAG,UAC3B,GAAM,EACN,YAAe,EACf,kBAGC;IAEO,IAAA,GAAG,GAAU,kBAAkB,IAA5B,EAAE,GAAG,GAAK,kBAAkB,IAAvB,CAAwB;IAExC,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,YAAY,iCAChC,CAAC,MAAM,CAAC,wBAAwB,CAAC,GAAG,EAAE,YAAY,CAAC,IAAI;QACtD,YAAY,EAAE,IAAI;QAClB,cAAc,EAAE,IAAI;KACvB,CAAC,GACC,CAAC,GAAG,KAAK,SAAS;QACjB,CAAC,CAAC;YACI,KAAK,EAAE;gBACH,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1B,CAAC;SACJ;QACH,CAAC,CAAC,EAAE,CAAC,GACN,CAAC,GAAG,KAAK,SAAS;QACjB,CAAC,CAAC;YACI,KAAK,EAAE,UAAU,KAAW;gBACxB,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAC1B,CAAC;SACJ;QACH,CAAC,CAAC,EAAE,CAAC,EACX,CAAC;AACP,CAAC,CAAC;AA9BW,QAAA,eAAe,mBA8B1B"} \ No newline at end of file diff --git a/lab/index.d.ts b/lab/index.d.ts new file mode 100644 index 0000000..1817599 --- /dev/null +++ b/lab/index.d.ts @@ -0,0 +1,5 @@ +export * from "./defineAccessors"; +export * from "./overwriteReadonlyProp"; +export * from "./PromiseOrNot"; +export * from "./UnpackTypeGuard"; +export * from "./withDefaults"; diff --git a/lab/index.js b/lab/index.js new file mode 100644 index 0000000..5daa01b --- /dev/null +++ b/lab/index.js @@ -0,0 +1,22 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./defineAccessors"), exports); +__exportStar(require("./overwriteReadonlyProp"), exports); +__exportStar(require("./PromiseOrNot"), exports); +__exportStar(require("./UnpackTypeGuard"), exports); +__exportStar(require("./withDefaults"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lab/index.js.map b/lab/index.js.map new file mode 100644 index 0000000..5037606 --- /dev/null +++ b/lab/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lab/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,0DAAwC;AACxC,iDAA+B;AAC/B,oDAAkC;AAClC,iDAA+B"} \ No newline at end of file diff --git a/lab/overwriteReadonlyProp.d.ts b/lab/overwriteReadonlyProp.d.ts new file mode 100644 index 0000000..225c2c2 --- /dev/null +++ b/lab/overwriteReadonlyProp.d.ts @@ -0,0 +1,7 @@ +/** + * Assign a value to a property even if the object is freezed or if the property is not writable + * Throw if the assignation fail ( for example if the property is non configurable write: false ) + * */ +export declare const overwriteReadonlyProp: (obj: T, propertyName: K, value: T[K]) => T[K]; diff --git a/lab/overwriteReadonlyProp.js b/lab/overwriteReadonlyProp.js new file mode 100644 index 0000000..5a32970 --- /dev/null +++ b/lab/overwriteReadonlyProp.js @@ -0,0 +1,52 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.overwriteReadonlyProp = void 0; +/* eslint-disable no-empty */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +var assert_1 = require("../assert"); +var is_1 = require("../is"); +/** + * Assign a value to a property even if the object is freezed or if the property is not writable + * Throw if the assignation fail ( for example if the property is non configurable write: false ) + * */ +var overwriteReadonlyProp = function (obj, propertyName, value) { + try { + obj[propertyName] = value; + } + catch (_a) { } + if (obj[propertyName] === value) { + return value; + } + var errorDefineProperty = undefined; + var propertyDescriptor = Object.getOwnPropertyDescriptor(obj, propertyName) || { + "enumerable": true, + "configurable": true, + }; + if (!!propertyDescriptor.get) { + throw new Error("Probably a wrong ides to overwrite ".concat(String(propertyName), " getter")); + } + try { + Object.defineProperty(obj, propertyName, __assign(__assign({}, propertyDescriptor), { value: value })); + } + catch (error) { + (0, assert_1.assert)((0, is_1.is)(error)); + errorDefineProperty = error; + } + if (obj[propertyName] !== value) { + throw errorDefineProperty || new Error("Can't assign"); + } + return value; +}; +exports.overwriteReadonlyProp = overwriteReadonlyProp; +//# sourceMappingURL=overwriteReadonlyProp.js.map \ No newline at end of file diff --git a/lab/overwriteReadonlyProp.js.map b/lab/overwriteReadonlyProp.js.map new file mode 100644 index 0000000..6c8264e --- /dev/null +++ b/lab/overwriteReadonlyProp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"overwriteReadonlyProp.js","sourceRoot":"","sources":["../src/lab/overwriteReadonlyProp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,6BAA6B;AAC7B,uDAAuD;AACvD,oCAAmC;AACnC,4BAA2B;AAE3B;;;KAGK;AACE,IAAM,qBAAqB,GAAG,UACjC,GAAM,EACN,YAAe,EACf,KAAW;IAEX,IAAI;QACA,GAAG,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC;KAC7B;IAAC,WAAM,GAAE;IAEV,IAAI,GAAG,CAAC,YAAY,CAAC,KAAK,KAAK,EAAE;QAC7B,OAAO,KAAK,CAAC;KAChB;IAED,IAAI,mBAAmB,GAAsB,SAAS,CAAC;IAEvD,IAAM,kBAAkB,GAAuB,MAAM,CAAC,wBAAwB,CAC1E,GAAG,EACH,YAAY,CACf,IAAI;QACD,YAAY,EAAE,IAAI;QAClB,cAAc,EAAE,IAAI;KACvB,CAAC;IAEF,IAAI,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,6CAAsC,MAAM,CAAC,YAAY,CAAC,YAAS,CAAC,CAAC;KACxF;IAED,IAAI;QACA,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,YAAY,wBAChC,kBAAkB,KACrB,KAAK,OAAA,IACP,CAAC;KACN;IAAC,OAAO,KAAK,EAAE;QACZ,IAAA,eAAM,EAAC,IAAA,OAAE,EAAQ,KAAK,CAAC,CAAC,CAAC;QACzB,mBAAmB,GAAG,KAAK,CAAC;KAC/B;IAED,IAAI,GAAG,CAAC,YAAY,CAAC,KAAK,KAAK,EAAE;QAC7B,MAAM,mBAAmB,IAAI,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;KAC1D;IAED,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AA1CW,QAAA,qBAAqB,yBA0ChC"} \ No newline at end of file diff --git a/lab/withDefaults.d.ts b/lab/withDefaults.d.ts new file mode 100644 index 0000000..e6ec041 --- /dev/null +++ b/lab/withDefaults.d.ts @@ -0,0 +1,16 @@ +import "../tools/Object.fromEntries"; +/** + * Like Function.prototype.bind() but for a function that + * receives their parameters wrapped in an object. + * See documentation for more details: + * https://docs.tsafe.dev/withdefaults + */ +export declare function withDefaults, DefaultKey extends keyof Params, R>(f: (params: Params) => R, defaultParams: keyof Params extends never ? Record : { + [Key in DefaultKey]: Params[Key]; +}): (params: { + [Key in keyof Omit]: Params[Key]; +} & { + defaultsOverwrite?: { + [Key in DefaultKey]?: [Params[Key]]; + }; +}) => R; diff --git a/lab/withDefaults.js b/lab/withDefaults.js new file mode 100644 index 0000000..81ae1bc --- /dev/null +++ b/lab/withDefaults.js @@ -0,0 +1,66 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.withDefaults = void 0; +/* eslint-disable @typescript-eslint/ban-ts-comment */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +require("../tools/Object.fromEntries"); +/** + * Like Function.prototype.bind() but for a function that + * receives their parameters wrapped in an object. + * See documentation for more details: + * https://docs.tsafe.dev/withdefaults + */ +function withDefaults(f, defaultParams) { + return function (params) { + var _a = params.defaultsOverwrite, defaultsOverwrite = _a === void 0 ? {} : _a, actualParams = __rest(params, ["defaultsOverwrite"]); + return f(__assign(__assign(__assign({}, defaultParams), actualParams), Object.fromEntries(Object.entries(defaultsOverwrite) + .filter(function (_a) { + var _b = __read(_a, 2), value = _b[1]; + return value !== undefined; + }) + .map(function (_a) { + var _b = __read(_a, 2), key = _b[0], value = _b[1]; + return [key, value[0]]; + })))); + }; +} +exports.withDefaults = withDefaults; +//# sourceMappingURL=withDefaults.js.map \ No newline at end of file diff --git a/lab/withDefaults.js.map b/lab/withDefaults.js.map new file mode 100644 index 0000000..4820e9a --- /dev/null +++ b/lab/withDefaults.js.map @@ -0,0 +1 @@ +{"version":3,"file":"withDefaults.js","sourceRoot":"","sources":["../src/lab/withDefaults.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAsD;AACtD,uDAAuD;AACvD,uCAAqC;AACrC;;;;;GAKG;AACH,SAAgB,YAAY,CACxB,CAAwB,EACxB,aAE0C;IAM1C,OAAO,UAAA,MAAM;QACD,IAAA,KAA4C,MAAM,kBAA5B,EAAtB,iBAAiB,mBAAG,EAAE,KAAA,EAAK,YAAY,UAAK,MAAM,EAApD,qBAA2C,CAAF,CAAY;QAE3D,OAAO,CAAC,CAAC,+BACF,aAAa,GACb,YAAY,GACZ,MAAM,CAAC,WAAW,CACjB,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC;aAC5B,MAAM,CAAC,UAAC,EAAS;gBAAT,KAAA,aAAS,EAAN,KAAK,QAAA;YAAM,OAAA,KAAK,KAAK,SAAS;QAAnB,CAAmB,CAAC;aAC1C,GAAG,CAAC,UAAC,EAAY;gBAAZ,KAAA,aAAY,EAAX,GAAG,QAAA,EAAE,KAAK,QAAA;YAAM,OAAA,CAAC,GAAG,EAAG,KAAa,CAAC,CAAC,CAAC,CAAC;QAAxB,CAAwB,CAAC,CACvD,CACG,CAAC,CAAC;IACd,CAAC,CAAC;AACN,CAAC;AAvBD,oCAuBC"} \ No newline at end of file diff --git a/noUndefined.d.ts b/noUndefined.d.ts new file mode 100644 index 0000000..51e3bbc --- /dev/null +++ b/noUndefined.d.ts @@ -0,0 +1,9 @@ +/** + * Removes the enumerable properties whose values are + * undefined. + * + * Example: + * noUndefined({ "foo": undefined, "bar": 3 }) returns + * a new object { "bar": 3 } + */ +export declare function noUndefined(obj: T): T; diff --git a/noUndefined.js b/noUndefined.js new file mode 100644 index 0000000..38de3a4 --- /dev/null +++ b/noUndefined.js @@ -0,0 +1,25 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/ban-types */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.noUndefined = void 0; +/** + * Removes the enumerable properties whose values are + * undefined. + * + * Example: + * noUndefined({ "foo": undefined, "bar": 3 }) returns + * a new object { "bar": 3 } + */ +function noUndefined(obj) { + var out = {}; + for (var key in obj) { + if (obj[key] === undefined) { + continue; + } + out[key] = obj[key]; + } + return out; +} +exports.noUndefined = noUndefined; +//# sourceMappingURL=noUndefined.js.map \ No newline at end of file diff --git a/noUndefined.js.map b/noUndefined.js.map new file mode 100644 index 0000000..0cdec46 --- /dev/null +++ b/noUndefined.js.map @@ -0,0 +1 @@ +{"version":3,"file":"noUndefined.js","sourceRoot":"","sources":["src/noUndefined.ts"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,iDAAiD;;;AAEjD;;;;;;;GAOG;AACH,SAAgB,WAAW,CAAmB,GAAM;IAChD,IAAM,GAAG,GAAe,EAAS,CAAC;IAElC,KAAK,IAAM,GAAG,IAAI,GAAG,EAAE;QACnB,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;YACxB,SAAS;SACZ;QAED,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;KACvB;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AAZD,kCAYC"} \ No newline at end of file diff --git a/objectEntries.d.ts b/objectEntries.d.ts new file mode 100644 index 0000000..723eabc --- /dev/null +++ b/objectEntries.d.ts @@ -0,0 +1,8 @@ +/** https://docs.tsafe.dev/objectentries */ +export declare function objectEntries>(o: O): Exclude<{ + [Key in keyof O]: [Key, O[Key]]; +}[keyof O], undefined>[]; +/** Return type of objectEntries https://docs.tsafe.dev/objectentries */ +export type ObjectEntries> = Exclude<{ + [Key in keyof O]: [Key, O[Key]]; +}[keyof O], undefined>[]; diff --git a/objectEntries.js b/objectEntries.js new file mode 100644 index 0000000..9ed95e4 --- /dev/null +++ b/objectEntries.js @@ -0,0 +1,10 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.objectEntries = void 0; +/** https://docs.tsafe.dev/objectentries */ +function objectEntries(o) { + return Object.entries(o); +} +exports.objectEntries = objectEntries; +//# sourceMappingURL=objectEntries.js.map \ No newline at end of file diff --git a/objectEntries.js.map b/objectEntries.js.map new file mode 100644 index 0000000..db776db --- /dev/null +++ b/objectEntries.js.map @@ -0,0 +1 @@ +{"version":3,"file":"objectEntries.js","sourceRoot":"","sources":["src/objectEntries.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;AAEvD,2CAA2C;AAC3C,SAAgB,aAAa,CACzB,CAAI;IAEJ,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAQ,CAAC;AACpC,CAAC;AAJD,sCAIC"} \ No newline at end of file diff --git a/objectFromEntries.d.ts b/objectFromEntries.d.ts new file mode 100644 index 0000000..09e62db --- /dev/null +++ b/objectFromEntries.d.ts @@ -0,0 +1,8 @@ +/** https://docs.tsafe.dev/objectFromEntries */ +export declare function objectFromEntries(entries: readonly Entry[]): { + [Key in Entry[0]]: Extract[1]; +}; +/** Return type of objectFromEntries https://docs.tsafe.dev/objectFromEntries */ +export type ObjectFromEntries = { + [Key in Entry[0]]: Extract[1]; +}; diff --git a/objectFromEntries.js b/objectFromEntries.js new file mode 100644 index 0000000..dfd9517 --- /dev/null +++ b/objectFromEntries.js @@ -0,0 +1,10 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.objectFromEntries = void 0; +/** https://docs.tsafe.dev/objectFromEntries */ +function objectFromEntries(entries) { + return Object.fromEntries(entries); +} +exports.objectFromEntries = objectFromEntries; +//# sourceMappingURL=objectFromEntries.js.map \ No newline at end of file diff --git a/objectFromEntries.js.map b/objectFromEntries.js.map new file mode 100644 index 0000000..7067ac6 --- /dev/null +++ b/objectFromEntries.js.map @@ -0,0 +1 @@ +{"version":3,"file":"objectFromEntries.js","sourceRoot":"","sources":["src/objectFromEntries.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;AAEvD,+CAA+C;AAC/C,SAAgB,iBAAiB,CAC7B,OAAyB;IAEzB,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAQ,CAAC;AAC9C,CAAC;AAJD,8CAIC"} \ No newline at end of file diff --git a/objectKeys.d.ts b/objectKeys.d.ts new file mode 100644 index 0000000..103b048 --- /dev/null +++ b/objectKeys.d.ts @@ -0,0 +1,2 @@ +/** https://docs.tsafe.dev/objectKeys */ +export declare function objectKeys>(o: T): (keyof T)[]; diff --git a/objectKeys.js b/objectKeys.js new file mode 100644 index 0000000..3dc1c30 --- /dev/null +++ b/objectKeys.js @@ -0,0 +1,10 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.objectKeys = void 0; +/** https://docs.tsafe.dev/objectKeys */ +function objectKeys(o) { + return Object.keys(o); +} +exports.objectKeys = objectKeys; +//# sourceMappingURL=objectKeys.js.map \ No newline at end of file diff --git a/objectKeys.js.map b/objectKeys.js.map new file mode 100644 index 0000000..9d4adca --- /dev/null +++ b/objectKeys.js.map @@ -0,0 +1 @@ +{"version":3,"file":"objectKeys.js","sourceRoot":"","sources":["src/objectKeys.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;AAEvD,wCAAwC;AACxC,SAAgB,UAAU,CAAoC,CAAI;IAC9D,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAQ,CAAC;AACjC,CAAC;AAFD,gCAEC"} \ No newline at end of file diff --git a/package.json b/package.json index b6f1b0b..df435b4 100755 --- a/package.json +++ b/package.json @@ -6,17 +6,6 @@ "type": "git", "url": "git://github.com/garronej/tsafe.git" }, - "scripts": { - "build": "tsc && denoify", - "test": "yarn test:node && yarn test:deno", - "test:deno": "deno run --reload --unstable --no-check deno_dist/mod.ts", - "test:node": "ts-node test/index.ts", - "lint:check": "eslint . --ext .ts,.tsx", - "lint": "npm run lint:check -- --fix", - "_format": "prettier '**/*.{ts,tsx,json,md}'", - "format": "npm run _format -- --write", - "format:check": "npm run _format -- --list-different" - }, "lint-staged": { "*.{ts,tsx}": [ "eslint --fix" @@ -32,18 +21,175 @@ }, "author": "u/garronej", "license": "MIT", - "main": "dist/index.js", - "types": "dist/index.d.ts", + "main": "index.js", + "types": "index.d.ts", "exports": { - ".": "./dist/index.js", - "./*": "./dist/*.js", - "./lab": "./dist/lab/index.js", - "./tools": "./dist/tools/index.js" + ".": "./index.js", + "./*": "./*.js", + "./lab": "./lab/index.js", + "./tools": "./tools/index.js" }, "files": [ - "src/", - "dist/", - "!dist/tsconfig.tsbuildinfo" + "src/Equals.ts", + "src/Extends.ts", + "src/MethodNames.ts", + "src/Not.ts", + "src/Param0.ts", + "src/Parameters.ts", + "src/PickOptionals.ts", + "src/PickRequired.ts", + "src/Reflect.ts", + "src/ReturnType.ts", + "src/UnionToIntersection.ts", + "src/UnpackPromise.ts", + "src/assert.ts", + "src/capitalize.ts", + "src/exclude.ts", + "src/flip.ts", + "src/id.ts", + "src/index.ts", + "src/is.ts", + "src/isPromiseLike.ts", + "src/lab/PromiseOrNot.ts", + "src/lab/UnpackTypeGuard.ts", + "src/lab/defineAccessors.ts", + "src/lab/index.ts", + "src/lab/overwriteReadonlyProp.ts", + "src/lab/withDefaults.ts", + "src/noUndefined.ts", + "src/objectEntries.ts", + "src/objectFromEntries.ts", + "src/objectKeys.ts", + "src/symToStr.ts", + "src/tools/Object.fromEntries.ts", + "src/tools/StrictEquals.ts", + "src/tools/Unite.ts", + "src/tools/getProjectRoot.ts", + "src/tools/index.ts", + "src/tools/toUpperCase.ts", + "src/typeGuard.ts", + "src/uncapitalize.ts", + "src/zz_internal/assertIsRefWrapper.ts", + "Equals.d.ts", + "Equals.js", + "Equals.js.map", + "Extends.d.ts", + "Extends.js", + "Extends.js.map", + "MethodNames.d.ts", + "MethodNames.js", + "MethodNames.js.map", + "Not.d.ts", + "Not.js", + "Not.js.map", + "Param0.d.ts", + "Param0.js", + "Param0.js.map", + "Parameters.d.ts", + "Parameters.js", + "Parameters.js.map", + "PickOptionals.d.ts", + "PickOptionals.js", + "PickOptionals.js.map", + "PickRequired.d.ts", + "PickRequired.js", + "PickRequired.js.map", + "Reflect.d.ts", + "Reflect.js", + "Reflect.js.map", + "ReturnType.d.ts", + "ReturnType.js", + "ReturnType.js.map", + "UnionToIntersection.d.ts", + "UnionToIntersection.js", + "UnionToIntersection.js.map", + "UnpackPromise.d.ts", + "UnpackPromise.js", + "UnpackPromise.js.map", + "assert.d.ts", + "assert.js", + "assert.js.map", + "capitalize.d.ts", + "capitalize.js", + "capitalize.js.map", + "exclude.d.ts", + "exclude.js", + "exclude.js.map", + "flip.d.ts", + "flip.js", + "flip.js.map", + "id.d.ts", + "id.js", + "id.js.map", + "index.d.ts", + "index.js", + "index.js.map", + "is.d.ts", + "is.js", + "is.js.map", + "isPromiseLike.d.ts", + "isPromiseLike.js", + "isPromiseLike.js.map", + "lab/PromiseOrNot.d.ts", + "lab/PromiseOrNot.js", + "lab/PromiseOrNot.js.map", + "lab/UnpackTypeGuard.d.ts", + "lab/UnpackTypeGuard.js", + "lab/UnpackTypeGuard.js.map", + "lab/defineAccessors.d.ts", + "lab/defineAccessors.js", + "lab/defineAccessors.js.map", + "lab/index.d.ts", + "lab/index.js", + "lab/index.js.map", + "lab/overwriteReadonlyProp.d.ts", + "lab/overwriteReadonlyProp.js", + "lab/overwriteReadonlyProp.js.map", + "lab/withDefaults.d.ts", + "lab/withDefaults.js", + "lab/withDefaults.js.map", + "noUndefined.d.ts", + "noUndefined.js", + "noUndefined.js.map", + "objectEntries.d.ts", + "objectEntries.js", + "objectEntries.js.map", + "objectFromEntries.d.ts", + "objectFromEntries.js", + "objectFromEntries.js.map", + "objectKeys.d.ts", + "objectKeys.js", + "objectKeys.js.map", + "symToStr.d.ts", + "symToStr.js", + "symToStr.js.map", + "tools/Object.fromEntries.d.ts", + "tools/Object.fromEntries.js", + "tools/Object.fromEntries.js.map", + "tools/StrictEquals.d.ts", + "tools/StrictEquals.js", + "tools/StrictEquals.js.map", + "tools/Unite.d.ts", + "tools/Unite.js", + "tools/Unite.js.map", + "tools/getProjectRoot.d.ts", + "tools/getProjectRoot.js", + "tools/getProjectRoot.js.map", + "tools/index.d.ts", + "tools/index.js", + "tools/index.js.map", + "tools/toUpperCase.d.ts", + "tools/toUpperCase.js", + "tools/toUpperCase.js.map", + "typeGuard.d.ts", + "typeGuard.js", + "typeGuard.js.map", + "uncapitalize.d.ts", + "uncapitalize.js", + "uncapitalize.js.map", + "zz_internal/assertIsRefWrapper.d.ts", + "zz_internal/assertIsRefWrapper.js", + "zz_internal/assertIsRefWrapper.js.map" ], "keywords": [], "homepage": "https://github.com/garronej/tsafe", diff --git a/symToStr.d.ts b/symToStr.d.ts new file mode 100644 index 0000000..2b817d2 --- /dev/null +++ b/symToStr.d.ts @@ -0,0 +1,2 @@ +/** @see */ +export declare function symToStr>(wrap: T): keyof T; diff --git a/symToStr.js b/symToStr.js new file mode 100644 index 0000000..ba19037 --- /dev/null +++ b/symToStr.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.symToStr = void 0; +/** @see */ +function symToStr(wrap) { + return Object.keys(wrap)[0]; +} +exports.symToStr = symToStr; +//# sourceMappingURL=symToStr.js.map \ No newline at end of file diff --git a/symToStr.js.map b/symToStr.js.map new file mode 100644 index 0000000..16feaa0 --- /dev/null +++ b/symToStr.js.map @@ -0,0 +1 @@ +{"version":3,"file":"symToStr.js","sourceRoot":"","sources":["src/symToStr.ts"],"names":[],"mappings":";;;AAAA,kDAAkD;AAClD,SAAgB,QAAQ,CAAoC,IAAO;IAC/D,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC;AAFD,4BAEC"} \ No newline at end of file diff --git a/tools/Object.fromEntries.d.ts b/tools/Object.fromEntries.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/tools/Object.fromEntries.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/Object.fromEntries.js b/tools/Object.fromEntries.js new file mode 100644 index 0000000..caf91f2 --- /dev/null +++ b/tools/Object.fromEntries.js @@ -0,0 +1,35 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +if (!Object.fromEntries) { + Object.defineProperty(Object, "fromEntries", { + "value": function (entries) { + if (!entries || !entries[Symbol.iterator]) { + throw new Error("Object.fromEntries() requires a single iterable argument"); + } + var o = {}; + Object.keys(entries).forEach(function (key) { + var _a = __read(entries[key], 2), k = _a[0], v = _a[1]; + o[k] = v; + }); + return o; + }, + }); +} +//# sourceMappingURL=Object.fromEntries.js.map \ No newline at end of file diff --git a/tools/Object.fromEntries.js.map b/tools/Object.fromEntries.js.map new file mode 100644 index 0000000..fe73689 --- /dev/null +++ b/tools/Object.fromEntries.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Object.fromEntries.js","sourceRoot":"","sources":["../src/tools/Object.fromEntries.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;;;;;;;;;;;;;;;;AAEvD,IAAI,CAAE,MAAc,CAAC,WAAW,EAAE;IAC9B,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE;QACzC,OAAO,EAAE,UAAU,OAAY;YAC3B,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;gBACvC,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;aAC/E;YAED,IAAM,CAAC,GAAQ,EAAE,CAAC;YAElB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;gBACtB,IAAA,KAAA,OAAS,OAAO,CAAC,GAAG,CAAC,IAAA,EAApB,CAAC,QAAA,EAAE,CAAC,QAAgB,CAAC;gBAE5B,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACb,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,CAAC;QACb,CAAC;KACJ,CAAC,CAAC;CACN"} \ No newline at end of file diff --git a/tools/StrictEquals.d.ts b/tools/StrictEquals.d.ts new file mode 100644 index 0000000..0871a91 --- /dev/null +++ b/tools/StrictEquals.d.ts @@ -0,0 +1 @@ +export type StrictEquals = (() => A extends A2 ? true : false) extends () => A extends A1 ? true : false ? true : false; diff --git a/tools/StrictEquals.js b/tools/StrictEquals.js new file mode 100644 index 0000000..1fb6ccc --- /dev/null +++ b/tools/StrictEquals.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=StrictEquals.js.map \ No newline at end of file diff --git a/tools/StrictEquals.js.map b/tools/StrictEquals.js.map new file mode 100644 index 0000000..842deab --- /dev/null +++ b/tools/StrictEquals.js.map @@ -0,0 +1 @@ +{"version":3,"file":"StrictEquals.js","sourceRoot":"","sources":["../src/tools/StrictEquals.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tools/Unite.d.ts b/tools/Unite.d.ts new file mode 100644 index 0000000..a75c362 --- /dev/null +++ b/tools/Unite.d.ts @@ -0,0 +1,3 @@ +export type Unite = T extends Record ? { + [Key in keyof T]: T[Key]; +} : T; diff --git a/tools/Unite.js b/tools/Unite.js new file mode 100644 index 0000000..85f5b5d --- /dev/null +++ b/tools/Unite.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Unite.js.map \ No newline at end of file diff --git a/tools/Unite.js.map b/tools/Unite.js.map new file mode 100644 index 0000000..13e4c6f --- /dev/null +++ b/tools/Unite.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Unite.js","sourceRoot":"","sources":["../src/tools/Unite.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tools/getProjectRoot.d.ts b/tools/getProjectRoot.d.ts new file mode 100644 index 0000000..7927ee7 --- /dev/null +++ b/tools/getProjectRoot.d.ts @@ -0,0 +1 @@ +export declare function getProjectRoot(): string; diff --git a/tools/getProjectRoot.js b/tools/getProjectRoot.js new file mode 100644 index 0000000..c71599c --- /dev/null +++ b/tools/getProjectRoot.js @@ -0,0 +1,43 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getProjectRoot = void 0; +var fs = __importStar(require("fs")); +var path = __importStar(require("path")); +function getProjectRootRec(dirPath) { + if (fs.existsSync(path.join(dirPath, "package.json"))) { + return dirPath; + } + return getProjectRootRec(path.join(dirPath, "..")); +} +var result = undefined; +function getProjectRoot() { + if (result !== undefined) { + return result; + } + return (result = getProjectRootRec(__dirname)); +} +exports.getProjectRoot = getProjectRoot; +//# sourceMappingURL=getProjectRoot.js.map \ No newline at end of file diff --git a/tools/getProjectRoot.js.map b/tools/getProjectRoot.js.map new file mode 100644 index 0000000..54cd90d --- /dev/null +++ b/tools/getProjectRoot.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getProjectRoot.js","sourceRoot":"","sources":["../src/tools/getProjectRoot.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AACzB,yCAA6B;AAE7B,SAAS,iBAAiB,CAAC,OAAe;IACtC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,EAAE;QACnD,OAAO,OAAO,CAAC;KAClB;IACD,OAAO,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,IAAI,MAAM,GAAuB,SAAS,CAAC;AAE3C,SAAgB,cAAc;IAC1B,IAAI,MAAM,KAAK,SAAS,EAAE;QACtB,OAAO,MAAM,CAAC;KACjB;IAED,OAAO,CAAC,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;AACnD,CAAC;AAND,wCAMC"} \ No newline at end of file diff --git a/tools/index.d.ts b/tools/index.d.ts new file mode 100644 index 0000000..5c83482 --- /dev/null +++ b/tools/index.d.ts @@ -0,0 +1,5 @@ +export * from "./getProjectRoot"; +export * from "./Object.fromEntries"; +export * from "./StrictEquals"; +export * from "./toUpperCase"; +export * from "./Unite"; diff --git a/tools/index.js b/tools/index.js new file mode 100644 index 0000000..be67ef6 --- /dev/null +++ b/tools/index.js @@ -0,0 +1,22 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./getProjectRoot"), exports); +__exportStar(require("./Object.fromEntries"), exports); +__exportStar(require("./StrictEquals"), exports); +__exportStar(require("./toUpperCase"), exports); +__exportStar(require("./Unite"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/index.js.map b/tools/index.js.map new file mode 100644 index 0000000..487509f --- /dev/null +++ b/tools/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/tools/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,uDAAqC;AACrC,iDAA+B;AAC/B,gDAA8B;AAC9B,0CAAwB"} \ No newline at end of file diff --git a/tools/toUpperCase.d.ts b/tools/toUpperCase.d.ts new file mode 100644 index 0000000..c2dd61b --- /dev/null +++ b/tools/toUpperCase.d.ts @@ -0,0 +1 @@ +export declare function toUpperCase(str: string): string; diff --git a/tools/toUpperCase.js b/tools/toUpperCase.js new file mode 100644 index 0000000..0748db3 --- /dev/null +++ b/tools/toUpperCase.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toUpperCase = void 0; +function toUpperCase(str) { + return str.toUpperCase(); +} +exports.toUpperCase = toUpperCase; +//# sourceMappingURL=toUpperCase.js.map \ No newline at end of file diff --git a/tools/toUpperCase.js.map b/tools/toUpperCase.js.map new file mode 100644 index 0000000..952af8d --- /dev/null +++ b/tools/toUpperCase.js.map @@ -0,0 +1 @@ +{"version":3,"file":"toUpperCase.js","sourceRoot":"","sources":["../src/tools/toUpperCase.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAC,GAAW;IACnC,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC;AAC7B,CAAC;AAFD,kCAEC"} \ No newline at end of file diff --git a/tsconfig.tsbuildinfo b/tsconfig.tsbuildinfo new file mode 100644 index 0000000..9242388 --- /dev/null +++ b/tsconfig.tsbuildinfo @@ -0,0 +1 @@ +{"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../src/tools/Unite.ts","../src/tools/StrictEquals.ts","../src/Equals.ts","../src/Extends.ts","../src/MethodNames.ts","../src/Not.ts","../src/Parameters.ts","../src/Param0.ts","../src/PickOptionals.ts","../src/PickRequired.ts","../src/Reflect.ts","../src/ReturnType.ts","../src/UnionToIntersection.ts","../src/UnpackPromise.ts","../src/id.ts","../src/zz_internal/assertIsRefWrapper.ts","../src/is.ts","../src/lab/overwriteReadonlyProp.ts","../src/assert.ts","../src/capitalize.ts","../src/exclude.ts","../src/flip.ts","../src/isPromiseLike.ts","../src/objectKeys.ts","../src/typeGuard.ts","../src/objectEntries.ts","../src/objectFromEntries.ts","../src/noUndefined.ts","../src/uncapitalize.ts","../src/index.ts","../src/symToStr.ts","../src/lab/PromiseOrNot.ts","../src/lab/UnpackTypeGuard.ts","../src/lab/defineAccessors.ts","../src/tools/Object.fromEntries.ts","../src/lab/withDefaults.ts","../src/lab/index.ts","../src/tools/getProjectRoot.ts","../src/tools/toUpperCase.ts","../src/tools/index.ts","../node_modules/@types/comment-json/index.d.ts","../node_modules/@types/json-schema/index.d.ts","../node_modules/@types/node/assert.d.ts","../node_modules/@types/node/assert/strict.d.ts","../node_modules/@types/node/globals.d.ts","../node_modules/@types/node/async_hooks.d.ts","../node_modules/@types/node/buffer.d.ts","../node_modules/@types/node/child_process.d.ts","../node_modules/@types/node/cluster.d.ts","../node_modules/@types/node/console.d.ts","../node_modules/@types/node/constants.d.ts","../node_modules/@types/node/crypto.d.ts","../node_modules/@types/node/dgram.d.ts","../node_modules/@types/node/diagnostics_channel.d.ts","../node_modules/@types/node/dns.d.ts","../node_modules/@types/node/dns/promises.d.ts","../node_modules/@types/node/domain.d.ts","../node_modules/@types/node/dom-events.d.ts","../node_modules/@types/node/events.d.ts","../node_modules/@types/node/fs.d.ts","../node_modules/@types/node/fs/promises.d.ts","../node_modules/@types/node/http.d.ts","../node_modules/@types/node/http2.d.ts","../node_modules/@types/node/https.d.ts","../node_modules/@types/node/inspector.d.ts","../node_modules/@types/node/module.d.ts","../node_modules/@types/node/net.d.ts","../node_modules/@types/node/os.d.ts","../node_modules/@types/node/path.d.ts","../node_modules/@types/node/perf_hooks.d.ts","../node_modules/@types/node/process.d.ts","../node_modules/@types/node/punycode.d.ts","../node_modules/@types/node/querystring.d.ts","../node_modules/@types/node/readline.d.ts","../node_modules/@types/node/readline/promises.d.ts","../node_modules/@types/node/repl.d.ts","../node_modules/@types/node/stream.d.ts","../node_modules/@types/node/stream/promises.d.ts","../node_modules/@types/node/stream/consumers.d.ts","../node_modules/@types/node/stream/web.d.ts","../node_modules/@types/node/string_decoder.d.ts","../node_modules/@types/node/test.d.ts","../node_modules/@types/node/timers.d.ts","../node_modules/@types/node/timers/promises.d.ts","../node_modules/@types/node/tls.d.ts","../node_modules/@types/node/trace_events.d.ts","../node_modules/@types/node/tty.d.ts","../node_modules/@types/node/url.d.ts","../node_modules/@types/node/util.d.ts","../node_modules/@types/node/v8.d.ts","../node_modules/@types/node/vm.d.ts","../node_modules/@types/node/wasi.d.ts","../node_modules/@types/node/worker_threads.d.ts","../node_modules/@types/node/zlib.d.ts","../node_modules/@types/node/globals.global.d.ts","../node_modules/@types/node/index.d.ts","../node_modules/@types/parse-json/index.d.ts"],"fileInfos":[{"version":"6a6b471e7e43e15ef6f8fe617a22ce4ecb0e34efa6c3dfcfe7cebd392bcca9d2","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","dc48272d7c333ccf58034c0026162576b7d50ea0e69c3b9292f803fc20720fd5","27147504487dc1159369da4f4da8a26406364624fa9bc3db632f7d94a5bae2c3","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4",{"version":"fcd3ecc9f764f06f4d5c467677f4f117f6abf49dee6716283aa204ff1162498b","affectsGlobalScope":true},{"version":"f296963760430fb65b4e5d91f0ed770a91c6e77455bacf8fa23a1501654ede0e","affectsGlobalScope":true},{"version":"5114a95689b63f96b957e00216bc04baf9e1a1782aa4d8ee7e5e9acbf768e301","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"ab22100fdd0d24cfc2cc59d0a00fc8cf449830d9c4030dc54390a46bd562e929","affectsGlobalScope":true},{"version":"f7bd636ae3a4623c503359ada74510c4005df5b36de7f23e1db8a5c543fd176b","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"0c20f4d2358eb679e4ae8a4432bdd96c857a2960fd6800b21ec4008ec59d60ea","affectsGlobalScope":true},{"version":"36ae84ccc0633f7c0787bc6108386c8b773e95d3b052d9464a99cd9b8795fbec","affectsGlobalScope":true},{"version":"82d0d8e269b9eeac02c3bd1c9e884e85d483fcb2cd168bccd6bc54df663da031","affectsGlobalScope":true},{"version":"b8deab98702588840be73d67f02412a2d45a417a3c097b2e96f7f3a42ac483d1","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"376d554d042fb409cb55b5cbaf0b2b4b7e669619493c5d18d5fa8bd67273f82a","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"c4138a3dd7cd6cf1f363ca0f905554e8d81b45844feea17786cdf1626cb8ea06","affectsGlobalScope":true},{"version":"6ff3e2452b055d8f0ec026511c6582b55d935675af67cdb67dd1dc671e8065df","affectsGlobalScope":true},{"version":"03de17b810f426a2f47396b0b99b53a82c1b60e9cba7a7edda47f9bb077882f4","affectsGlobalScope":true},{"version":"8184c6ddf48f0c98429326b428478ecc6143c27f79b79e85740f17e6feb090f1","affectsGlobalScope":true},{"version":"261c4d2cf86ac5a89ad3fb3fafed74cbb6f2f7c1d139b0540933df567d64a6ca","affectsGlobalScope":true},{"version":"6af1425e9973f4924fca986636ac19a0cf9909a7e0d9d3009c349e6244e957b6","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"15a630d6817718a2ddd7088c4f83e4673fde19fa992d2eae2cf51132a302a5d3","affectsGlobalScope":true},{"version":"b7e9f95a7387e3f66be0ed6db43600c49cec33a3900437ce2fd350d9b7cb16f2","affectsGlobalScope":true},{"version":"01e0ee7e1f661acedb08b51f8a9b7d7f959e9cdb6441360f06522cc3aea1bf2e","affectsGlobalScope":true},{"version":"ac17a97f816d53d9dd79b0d235e1c0ed54a8cc6a0677e9a3d61efb480b2a3e4e","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"9cc66b0513ad41cb5f5372cca86ef83a0d37d1c1017580b7dace3ea5661836df","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"307c8b7ebbd7f23a92b73a4c6c0a697beca05b06b036c23a34553e5fe65e4fdc","affectsGlobalScope":true},{"version":"189c0703923150aa30673fa3de411346d727cc44a11c75d05d7cf9ef095daa22","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},{"version":"f6b19500d5de61452d537a4a495cfae224ff97de8b2afa9b156a14e261d9dc45","signature":"2ac80842d9cafe9e128a13bd4a26813cc5902ececc48de01367f38b52798bf8f"},{"version":"cee511e986619497af00106cfc033afa9cb907657eae7d216aa6685cfd91a7e4","signature":"18b1d10d73315c68e4a35eb2b70a662fa89f8c3a1287180f69415e80f9d4feb9"},{"version":"110591d5497e1331afc9009322bce3fcd623d16ae896a989a450b303a6757f80","signature":"72f1c4c1b9fb45abab255f752dd46cbd01c9126888e2a0cf2db27bc89b6987cb"},{"version":"f2e2c0e8770e501c726ced7a766be7b7e25b64132a00fe5ac41a12f191909c2d","signature":"9cb1cea28e8a631fc4a2ab73c83c0696baab7249b2cfadfd43ffca5e441abb35"},{"version":"a98f362ec9d130a8fee0ebe21a7ea2fcaef9fe9c8d49e228099a6e5bb1dc75b6","signature":"662db21955325cafe247411736fb00e6493204370917f70b67e4b5f3b93c3179"},"02da4f252835cd9cdc1049dc4f27a336f44fc3fb2b587e340d03de45a48830e4",{"version":"ed39a06fcdec4146b81408cbeccb66829034033a05221ea6892177709c472abc","signature":"260a8544fe628efaed6408401910135295ff450af5c8ab76822db61e63ac6a32"},{"version":"e841acd707c314fdbfc5cad43ed30b9ec19f0833447b0381c138009bfe2d794a","signature":"e896f32b7424fcc47a39ffaa580e2555f19da3129ad97e19825096e821a92d13"},{"version":"be2476a98a660ac0c6b14cb1bd09285f5d21e0fe5ba12b25adc2443db93421ce","signature":"00f6cb5af8f9ca81ad3e668aa743465587f0a609d3a7fbd113eefd561e6a137b"},{"version":"454fa710bcf4ac32638e96b0c467e1344165c927d221733aa2e77037b3539078","signature":"ce53f0cc7de2c5945e8828cc7651820a2ebdf90503a54de2bcf75f169ad2ad29"},{"version":"aa2712d356ed12a0c72a7f154d0160ecab56f06da86c21540b2645c90f7248d7","signature":"85d2371b2f96b2dd6ec7aa5f2d5099d5d10a4b4c614914f2b531872f7bdb037a"},{"version":"ea83c0ddd554616cfbede4b11b59910f4fc93f8c8001dea25f7837f74fcf3cc7","signature":"1eef420ff81e5840050097a0f15ab7858dca15aff0a2e9c7082c332c6fcef7ec"},{"version":"5d0131d555cfba19633e124db9690481132680bb12d0475744e3eb899fee6ba7","signature":"f90f19cd897274caa21b2eb127d4ba5218d9aa80f5f48f30fce74e60cb10ab05"},{"version":"37d5e328dceac953061ae95f6615f7ae4037f6ca53551c0fd246098e1142fe29","signature":"a2f01baa8dd04821fb53db2a4ce8770bed913354c5985163d0590fa4105db41a"},{"version":"cb2b74bfed19553b90e37af353c58c53ee113af1406c580ab0b7a4b44aa9b022","signature":"9675934b30a3ba0582a480228b0770bc8b6e0612db80d930f829c1349a9cbf13"},{"version":"f3af5f1e28a1bbdc6473af7d97fe8bd9981da9d5502e29e3ef0caba6d78c0286","signature":"18cde701f4334725dcb56bdb580927ff24545947ba588ab27f4324a9aa79c482"},{"version":"f9dc8e82e88e8bf771edc42784f27e283266b81a1d4de21e5b83b209cec0e5eb","signature":"d857125e272ccce6eddf49ec21fda452719f89ba62e52a46183437f1128ab46b"},{"version":"b3603893739a2eb1d0dbee833a63f9c16c04eb470ed4824f08c94d5c20c4b8d2","signature":"325901e778b557d39dc9796ce750c00e546cf13cfef7573717d77fb8c50687c8"},{"version":"0fe8193bf3519f66fb57cb1ea45ef14b6b0b5900c4c71ff2a21fbee442cc2d50","signature":"a6f092c0691a157888c4bfd6cda42352b1cb774d38e7154e4c8051dee5b5ab49"},{"version":"9732a6f8fc1811d8a5e0a75f20ffe08f6f41e7019f71eab3f357caa25e164bd5","signature":"e9a099972022f2501f43698c344d04d55bcfd93233474d11039baa00cfb28bc4"},{"version":"1731efeaa2199fbec2d277f13cd6876a0404eb34556bb615c3801d6915972b33","signature":"0671e930cb5a233fadcb68400874a859018113551c24576472487715129e3be6"},{"version":"cfa42eee23927d15b60d467db75d4c9c48b1d08b3d6511e6386ff77e42f0ee40","signature":"74b94d41129afb2f4ef6dae6669cc52f6352b83d11704e0143bbccbc483c2094"},{"version":"e190c6b9806e815d3a096c9af16028a848edd13b70b6e3d9e44ce2507089f17a","signature":"18f455507ad251d2e04fa76dc6e2a7ccb090329c092913fca6197c5fef5d19eb"},{"version":"2d04d4da6d9c7afae2559a9598ccebb3d1d4fd6b0b420cf7ca8f3c9f20c9a858","signature":"0074b2c395fdd7241199a53b6b5a04c56af5a56366c9108491ea3a07676f364b"},{"version":"8012ea9591da5ff83fa43d1a42c9911736b0f841726bc88a07deb53ae717f41b","signature":"5bb1f84b59523bb590af00c91dbe1d0d13502d8f5d69d20a1f44859fdc1f23b3"},{"version":"2bb83825af7e1950c04621e4d055814333d2cca24eb3aab95918ce95212a3561","signature":"82aeba550610395d2914fd6d1a4606d02b95a2a8b250a52ec303db71590b41b3"},{"version":"b0e20c5407a5e79d50bb90a9b445f4889c7ef562438db770b395515170e9b5e9","signature":"14aff5197faa1b13369c3d455556e61f3f1bd0cd856a9fddefc37714d5fddab5"},{"version":"112299f77f951fe6b8eb50821334f6aebcf574b5b7d89e2431b91fe1df55c7ab","signature":"4dde3a0c022816a842ebcaf7375b5e696736efd4836280377ec0aa0107879e4d"},{"version":"60cde8c6e76aa07d8f942c384b532ca01c14bcfde49561a6b17f95f9641d2dd8","signature":"05232bf12123918b55128f74d7534831fea94983e8766b0cd8e9b2247e70217b"},"8fac6e4274a31ccae54430f4e7a0805344015911fc4578f836c568283be8534d",{"version":"473fa81dbb0ed81faf43b694897693537760cb2914c4c4716064b4eff0751d66","signature":"3136ffb92a47e795c861317f98350e3a54b11ec8608f985341c45b43ddabdd82"},"ab46309b639fb01d162488e25afc36bf4a8da3ab37f09a6dc70c733a5b9829ba",{"version":"2f43d2ff5bc86c1612b2b8cc88095688d51107539a77c67a7d132814d482c06c","signature":"a14188d445479722060109930b6f38281cf57d2b370b6f3c4d89442504f3bed7"},{"version":"94e8eae7586e7b256cb3a0e266a0fb71d5307c542243963fad5f52c91ac40aa8","signature":"0ad7a2b067566d9ece83849e37f792792be0632809ccd3dc7eb0f44f82d40bd0"},{"version":"e260d3a5275e3b54fa5373f48ea39b3b4c876bbecfa09b0dc19d5dce2d311a2e","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"62e1bf47389b38255f5b77d5548e6983ee192a1bb2254bcd6c0333fc2ef13c34","signature":"da51336066b98b8b26a64d60f4185a10a801c71dc02c9065f8f90127e8813ce0"},"4d2aefa43e03d5a32d161ab91ed6c34a83c31573d107f6c2f503269552760727",{"version":"3e6239b7b45d4c78f745b459e3a8493af4be6a5fc078cbc6c471d5db77902a06","signature":"200426c8d87ae866a7eb0e9ce577ebd7b9437df0f4d166965840e01e96144eff"},{"version":"0f2ac3e73064d6a8ec7f3ef8c726ecc9bd2cc34045cf18b2ec8142790d75bbe7","signature":"55216b3caf3325c8aa65aab47b84e826fca2bb492e229733d5599cc2ba4958fe"},"efbcd0db768c8811b991e8b20165035182beb666381ff1db7044b4119aba5ee3","c401118ea6c6daa9f196013b0622c602d4faec565bb1cc6ca751d2a8fc295498","0359682c54e487c4cab2b53b2b4d35cc8dea4d9914bc6abcdb5701f8b8e745a4","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"ca72190df0eb9b09d4b600821c8c7b6c9747b75a1c700c4d57dc0bb72abc074c","affectsGlobalScope":true},"21a167fec8f933752fb8157f06d28fab6817af3ad9b0bdb1908a10762391eab9",{"version":"bb65c6267c5d6676be61acbf6604cf0a4555ac4b505df58ac15c831fcbff4e3e","affectsGlobalScope":true},"374ca798f244e464346f14301dc2a8b4b111af1a83b49fffef5906c338a1f922","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","dab86d9604fe40854ef3c0a6f9e8948873dc3509213418e5e457f410fd11200f","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","489532ff54b714f0e0939947a1c560e516d3ae93d51d639ab02e907a0e950114","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","d903fafe96674bc0b2ac38a5be4a8fc07b14c2548d1cdb165a80ea24c44c0c54","5eec82ac21f84d83586c59a16b9b8502d34505d1393393556682fe7e7fde9ef2","04eb6578a588d6a46f50299b55f30e3a04ef27d0c5a46c57d8fcc211cd530faa","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true},"d076fede3cb042e7b13fc29442aaa03a57806bc51e2b26a67a01fbc66a7c0c12","7c013aa892414a7fdcfd861ae524a668eaa3ede8c7c0acafaf611948122c8d93","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","fd93cee2621ff42dabe57b7be402783fd1aa69ece755bcba1e0290547ae60513","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","223c37f62ce09a3d99e77498acdee7b2705a4ae14552fbdb4093600cd9164f3f",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","4c8525f256873c7ba3135338c647eaf0ca7115a1a2805ae2d0056629461186ce","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"f0900cd5d00fe1263ff41201fb8073dbeb984397e4af3b8002a5c207a30bdc33","affectsGlobalScope":true},{"version":"4c50342e1b65d3bee2ed4ab18f84842d5724ad11083bd666d8705dc7a6079d80","affectsGlobalScope":true},"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"8dbe725f8d237e70310977afcfa011629804d101ebaa0266cafda6b61ad72236","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b"],"root":[[45,84]],"options":{"declaration":true,"downlevelIteration":true,"esModuleInterop":true,"jsx":4,"module":1,"newLine":1,"noFallthroughCasesInSwitch":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","sourceMap":true,"strict":true,"target":1},"fileIdsList":[[133],[87,133],[90,133],[91,96,124,133],[92,103,104,111,121,132,133],[92,93,103,111,133],[94,133],[95,96,104,112,133],[96,121,129,133],[97,99,103,111,133],[98,133],[99,100,133],[103,133],[101,103,133],[103,104,105,121,132,133],[103,104,105,118,121,124,133],[133,137],[99,106,111,121,132,133],[103,104,106,107,111,121,129,132,133],[106,108,121,129,132,133],[87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139],[103,109,133],[110,132,133],[99,103,111,121,133],[112,133],[113,133],[90,114,133],[115,131,133,137],[116,133],[117,133],[103,118,119,133],[118,120,133,135],[91,103,121,122,123,124,133],[91,121,123,133],[121,122,133],[124,133],[125,133],[103,127,128,133],[127,128,133],[96,111,121,129,133],[130,133],[111,131,133],[91,106,117,132,133],[96,133],[121,133,134],[133,135],[133,136],[91,96,103,105,114,121,132,133,135,137],[121,133,138],[45,46,133],[46,133],[51,133],[53,133],[47,60,62,133],[47,48,49,50,51,52,53,54,55,56,57,58,59,61,63,64,65,66,67,68,69,70,71,72,73,133],[60,133],[62,76,77,78,80,133],[61,63,133],[79,133],[104,113,133],[45,46,79,82,83,133],[59,133],[45,46],[46],[51],[53],[47],[79]],"referencedMap":[[85,1],[86,1],[87,2],[88,2],[90,3],[91,4],[92,5],[93,6],[94,7],[95,8],[96,9],[97,10],[98,11],[99,12],[100,12],[102,13],[101,14],[103,13],[104,15],[105,16],[89,17],[139,1],[106,18],[107,19],[108,20],[140,21],[109,22],[110,23],[111,24],[112,25],[113,26],[114,27],[115,28],[116,29],[117,30],[118,31],[119,31],[120,32],[121,33],[123,34],[122,35],[124,36],[125,37],[126,1],[127,38],[128,39],[129,40],[130,41],[131,42],[132,43],[133,44],[134,45],[135,46],[136,47],[137,48],[138,49],[141,1],[43,1],[44,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[33,1],[30,1],[31,1],[32,1],[34,1],[7,1],[35,1],[40,1],[41,1],[36,1],[37,1],[38,1],[39,1],[1,1],[42,1],[47,50],[48,51],[49,1],[50,1],[52,52],[51,1],[53,1],[54,53],[55,1],[56,1],[57,1],[58,1],[63,54],[64,1],[65,1],[66,1],[59,1],[74,55],[61,56],[67,1],[76,1],[77,1],[78,1],[81,57],[62,58],[80,59],[72,1],[70,1],[71,1],[68,1],[75,1],[79,1],[46,1],[45,1],[82,60],[84,61],[83,1],[69,1],[73,1],[60,62]],"exportedModulesMap":[[85,1],[86,1],[87,2],[88,2],[90,3],[91,4],[92,5],[93,6],[94,7],[95,8],[96,9],[97,10],[98,11],[99,12],[100,12],[102,13],[101,14],[103,13],[104,15],[105,16],[89,17],[139,1],[106,18],[107,19],[108,20],[140,21],[109,22],[110,23],[111,24],[112,25],[113,26],[114,27],[115,28],[116,29],[117,30],[118,31],[119,31],[120,32],[121,33],[123,34],[122,35],[124,36],[125,37],[126,1],[127,38],[128,39],[129,40],[130,41],[131,42],[132,43],[133,44],[134,45],[135,46],[136,47],[137,48],[138,49],[141,1],[43,1],[44,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[33,1],[30,1],[31,1],[32,1],[34,1],[7,1],[35,1],[40,1],[41,1],[36,1],[37,1],[38,1],[39,1],[1,1],[42,1],[47,63],[48,64],[50,1],[52,65],[54,66],[63,67],[74,55],[76,1],[81,57],[80,68],[84,61]],"semanticDiagnosticsPerFile":[85,86,87,88,90,91,92,93,94,95,96,97,98,99,100,102,101,103,104,105,89,139,106,107,108,140,109,110,111,112,113,114,115,116,117,118,119,120,121,123,122,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,141,43,44,8,10,9,2,11,12,13,14,15,16,17,18,3,4,22,19,20,21,23,24,25,5,26,27,28,29,6,33,30,31,32,34,7,35,40,41,36,37,38,39,1,42,47,48,49,50,52,51,53,54,55,56,57,58,63,64,65,66,59,74,61,67,76,77,78,81,62,80,72,70,71,68,75,79,46,45,82,84,83,69,73,60]},"version":"5.0.4"} \ No newline at end of file diff --git a/typeGuard.d.ts b/typeGuard.d.ts new file mode 100644 index 0000000..e5924e2 --- /dev/null +++ b/typeGuard.d.ts @@ -0,0 +1,2 @@ +/** https://docs.tsafe.dev/typeguard */ +export declare function typeGuard(_value: any, isMatched: boolean): _value is T; diff --git a/typeGuard.js b/typeGuard.js new file mode 100644 index 0000000..f791f45 --- /dev/null +++ b/typeGuard.js @@ -0,0 +1,11 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-namespace */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.typeGuard = void 0; +/** https://docs.tsafe.dev/typeguard */ +function typeGuard(_value, isMatched) { + return isMatched; +} +exports.typeGuard = typeGuard; +//# sourceMappingURL=typeGuard.js.map \ No newline at end of file diff --git a/typeGuard.js.map b/typeGuard.js.map new file mode 100644 index 0000000..7cca5b8 --- /dev/null +++ b/typeGuard.js.map @@ -0,0 +1 @@ +{"version":3,"file":"typeGuard.js","sourceRoot":"","sources":["src/typeGuard.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,uDAAuD;;;AAEvD,uCAAuC;AACvC,SAAgB,SAAS,CAAI,MAAW,EAAE,SAAkB;IACxD,OAAO,SAAS,CAAC;AACrB,CAAC;AAFD,8BAEC"} \ No newline at end of file diff --git a/uncapitalize.d.ts b/uncapitalize.d.ts new file mode 100644 index 0000000..1496b91 --- /dev/null +++ b/uncapitalize.d.ts @@ -0,0 +1,2 @@ +/** @see */ +export declare function uncapitalize(str: S): Uncapitalize; diff --git a/uncapitalize.js b/uncapitalize.js new file mode 100644 index 0000000..e0e25ce --- /dev/null +++ b/uncapitalize.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.uncapitalize = void 0; +/** @see */ +function uncapitalize(str) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (str.charAt(0).toLowerCase() + str.slice(1)); +} +exports.uncapitalize = uncapitalize; +//# sourceMappingURL=uncapitalize.js.map \ No newline at end of file diff --git a/uncapitalize.js.map b/uncapitalize.js.map new file mode 100644 index 0000000..ac4ea17 --- /dev/null +++ b/uncapitalize.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uncapitalize.js","sourceRoot":"","sources":["src/uncapitalize.ts"],"names":[],"mappings":";;;AAAA,4DAA4D;AAC5D,SAAgB,YAAY,CAAmB,GAAM;IACjD,8DAA8D;IAC9D,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAQ,CAAC;AAC/D,CAAC;AAHD,oCAGC"} \ No newline at end of file diff --git a/zz_internal/assertIsRefWrapper.d.ts b/zz_internal/assertIsRefWrapper.d.ts new file mode 100644 index 0000000..443d0e1 --- /dev/null +++ b/zz_internal/assertIsRefWrapper.d.ts @@ -0,0 +1,3 @@ +export declare const assertIsRefWrapper: { + ref: Record | undefined; +}; diff --git a/zz_internal/assertIsRefWrapper.js b/zz_internal/assertIsRefWrapper.js new file mode 100644 index 0000000..3db8e05 --- /dev/null +++ b/zz_internal/assertIsRefWrapper.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.assertIsRefWrapper = void 0; +var id_1 = require("../id"); +exports.assertIsRefWrapper = { + "ref": (0, id_1.id)(undefined), +}; +//# sourceMappingURL=assertIsRefWrapper.js.map \ No newline at end of file diff --git a/zz_internal/assertIsRefWrapper.js.map b/zz_internal/assertIsRefWrapper.js.map new file mode 100644 index 0000000..7e3e5c5 --- /dev/null +++ b/zz_internal/assertIsRefWrapper.js.map @@ -0,0 +1 @@ +{"version":3,"file":"assertIsRefWrapper.js","sourceRoot":"","sources":["../src/zz_internal/assertIsRefWrapper.ts"],"names":[],"mappings":";;;AAAA,4BAA2B;AAEd,QAAA,kBAAkB,GAAG;IAC9B,KAAK,EAAE,IAAA,OAAE,EAAoC,SAAS,CAAC;CAC1D,CAAC"} \ No newline at end of file