diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index 5aaeb74..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.4.8 enable_short_npm_import_path - npx -y -p denoify@1.4.8 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/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/test/Equals.ts b/deno_dist/test/Equals.ts new file mode 100644 index 0000000..18bc049 --- /dev/null +++ b/deno_dist/test/Equals.ts @@ -0,0 +1,42 @@ +import type { Equals } from "../Equals.ts"; +import { assert } from "../assert.ts"; +import type { Unite } from "../tools/Unite.ts"; +import type { StrictEquals } from "../tools/StrictEquals.ts"; + +type Shape = Circle | Square; + +type Circle = { + type: "circle"; + radius: number; +}; + +type Square = { + type: "square"; + sideLength: number; +}; + +{ + type Got = Unite; + + type Expected = Shape; + + assert>(); +} + +{ + type A = { + foo: string; + } & { + bar: number; + }; + + type B = { + foo: string; + bar: number; + }; + + //@ts-expect-error: Because of the & + assert>(); + + assert>(); +} diff --git a/deno_dist/test/Extends.ts b/deno_dist/test/Extends.ts new file mode 100644 index 0000000..1969aad --- /dev/null +++ b/deno_dist/test/Extends.ts @@ -0,0 +1,139 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import type { Equals } from "../Equals.ts"; +import type { Extends } from "../Extends.ts"; +import { assert } from "../assert.ts"; + +const emptyObj = {}; + +type EmptyObj = typeof emptyObj; + +type Fn = (...args: A) => R; + +type Obj = Record; + +function fn() { + return undefined; +} + +class A { + a = 1; +} + +{ + // identity + assert, true>>(); + assert, true>>(); + assert, true>>(); + assert, true>>(); + assert, true>>(); + assert, true>>(); + assert, true>>(); + assert, true>>(); + assert, true>>(); + assert, true>>(); + assert, true>>(); + assert, true>>(); + assert, true>>(); + assert, true>>(); +} + +{ + // never extends everything + assert, true>>(); + assert, true>>(); + assert, true>>(); + assert, true>>(); + + // nothing but itself extends never + assert, true>>(); + assert, false>>(); + assert, false>>(); + assert, false>>(); + + // any extends nothing but itself and unknown + assert, true>>(); + assert, false>>(); + assert, true>>(); + assert, false>>(); + + // unknown extends nothing but itself and any + assert, true>>(); + assert, false>>(); + assert, true>>(); + assert, false>>(); + + // everything extends any + assert, true>>(); + assert, true>>(); + assert, true>>(); + + // everything extends unknown + assert, true>>(); + assert, true>>(); + assert, true>>(); +} + +{ + // numbers + assert, true>>(); + assert, false>>(); +} + +{ + // functions + assert any, Fn>, true>>(); + assert void, Fn>, true>>(); + assert any, Fn>, true>>(); + assert, true>>(); + + assert, false>>(); + assert, false>>(); + assert, false>>(); + assert, false>>(); + assert, false>>(); + assert, false>>(); + assert, false>>(); + assert, false>>(); + assert, Fn>, false>>(); + assert, false>>(); +} + +{ + // arrays + assert, true>>(); + assert, true>>(); + assert, false>>(); + assert, true>>(); + assert, false>>(); + assert, true>>(); + assert, false>>(); + + assert, true>>(); + assert, false>>(); + assert, true>>(); + assert, false>>(); + + assert, true>>(); + assert, true>>(); + assert, false>>(); + assert, false>>(); + assert, false>>(); + assert, false>>(); +} + +{ + // objects + assert, true>>(); + assert, false>>(); + + assert>, true>>(); + assert, A>, false>>(); + + assert, true>>(); + assert, false>>(); + + assert, false>>(); + assert, true>>(); + assert, true>>(); + assert, false>>(); +} diff --git a/deno_dist/test/MethodNames.ts b/deno_dist/test/MethodNames.ts new file mode 100644 index 0000000..0c8f530 --- /dev/null +++ b/deno_dist/test/MethodNames.ts @@ -0,0 +1,60 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import type { MethodNames } from "../MethodNames.ts"; +import { assert } from "../assert.ts"; +import type { Equals } from "../Equals.ts"; + +{ + type A = { + a: string; + b: number; + + method1(): void; + method2?(params: { a: boolean; b: string }): number; + }; + + type Expected = "method1" | "method2"; + + type Got = MethodNames; + + assert>(); +} + +class Car { + public readonly foo: string; + + constructor() { + this.foo = "caca"; + } +} + +{ + type A = { + a: unknown; + b: unknown; + method1?(): void; + // eslint-disable-next-line @typescript-eslint/ban-types + method2: Function; + method3?: (args: { a: unknown }) => unknown; + Car: typeof Car; + }; + + type Expected = "method1" | "method3"; + type Got = MethodNames; + + assert>(); +} + +{ + interface A { + a: string; + b: string; + + method1(arg: unknown): unknown; + method2?: (arg: unknown) => unknown; + } + + type Expected = "method1" | "method2"; + type Got = MethodNames; + + assert>(); +} diff --git a/deno_dist/test/Parameters.ts b/deno_dist/test/Parameters.ts new file mode 100644 index 0000000..30c3ea7 --- /dev/null +++ b/deno_dist/test/Parameters.ts @@ -0,0 +1,56 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import type { Parameters } from "../Parameters.ts"; +import { assert } from "../assert.ts"; +import type { Equals } from "../Equals.ts"; + +{ + const myFunction = (arg1: unknown, arg2: string, extraParams: { a: number; b: number }) => { + return { + arg1, + arg2, + extraParams, + }; + }; + + type Expected = [arg1: unknown, arg2: string, extraParams: { a: number; b: number }]; + type Got = Parameters; + + assert>(); +} + +{ + type A = { + a: number; + method: (arg1: number, arg2?: string) => void; + }; + + type Expected = [arg1: number, arg2?: string | undefined]; // [number] | [number, string | undefined] + type Got = Parameters; + + assert>(); +} + +{ + //@ts-expect-error + type X = Parameters; +} + +{ + type Expected = [searchString: string, position?: number | undefined]; + type Got = Parameters; + + assert>(); +} + +{ + class A { + a: string; + constructor(a: string) { + this.a = a; + } + } + + //@ts-expect-error + type Got = Parameters; +} diff --git a/deno_dist/test/Params0.ts b/deno_dist/test/Params0.ts new file mode 100644 index 0000000..0be03b0 --- /dev/null +++ b/deno_dist/test/Params0.ts @@ -0,0 +1,80 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import type { Param0 } from "../Param0.ts"; +import { assert } from "../assert.ts"; +import type { Equals } from "../Equals.ts"; + +//@ts-ignore +function test() { + const f = (params: { foo: T; bar: U }) => { + return params; + }; + + type Expected = { + foo: T; + bar: U; + }; + + type Got = Param0; + + assert>(); +} + +//@ts-ignore +function test() { + const f = (params: { foo: T; bar: U }, a: unknown, b: unknown) => { + return { + ...params, + a, + b, + }; + }; + + type Expected = { + foo: T; + bar: U; + }; + + type Got = Param0; + + assert>(); +} + +{ + //@ts-expect-error + type Got = Params; +} + +{ + class A { + foo: number; + + constructor(foo: number) { + this.foo = foo; + } + } + + //@ts-expect-error + type Got = Params; +} + +{ + type Got = Param0; + type Expected = never; + + assert>(); +} + +{ + type Got = Param0<((params: { foo: string }) => void) | undefined | null | false | "">; + type Expected = { foo: string }; + + assert>(); +} + +{ + type Got = Param0<(() => void) | undefined | null | false | "">; + type Expected = void; + + assert>(); +} diff --git a/deno_dist/test/PickOptionals.ts b/deno_dist/test/PickOptionals.ts new file mode 100644 index 0000000..32e59a6 --- /dev/null +++ b/deno_dist/test/PickOptionals.ts @@ -0,0 +1,51 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import type { PickOptionals } from "../PickOptionals.ts"; +import { assert } from "../assert.ts"; +import type { Equals } from "../Equals.ts"; + +{ + type A = { + a: number; + b?: number; + method1(param: string): number; + method2?(params: { a: string; b: number }): typeof params; + }; + + type Expected = { + b: number; + method2(params: { a: string; b: number }): typeof params; + }; + type Got = PickOptionals; + + assert>(); +} + +{ + type A = { + a: number | undefined; + b?: string; + }; + + type Expected = { + b: string; + }; + type Got = PickOptionals; + + assert>(); +} + +{ + interface A { + a: number; + b: string; + c?: unknown; + method1?: () => void; + } + + //@ts-expect-error + type Got = PickOptionals; +} + +//@ts-expect-error +type X = PickOptionals; diff --git a/deno_dist/test/PickRequired.ts b/deno_dist/test/PickRequired.ts new file mode 100644 index 0000000..08dc03b --- /dev/null +++ b/deno_dist/test/PickRequired.ts @@ -0,0 +1,53 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import { PickRequired } from "../PickRequired.ts"; +import { assert } from "../assert.ts"; +import type { Equals } from "../Equals.ts"; + +{ + type A = { + a: number; + b?: number; + method1(param: string): number; + method2?(params: { a: string; b: number }): typeof params; + }; + + type Expected = { + a: number; + method1(param: string): number; + }; + + type Got = PickRequired; + + assert>(); +} + +{ + type A = { + a: number | undefined; + b?: string; + }; + + type Expected = { + a: number | undefined; + }; + + type Got = PickRequired; + + assert>(); +} + +{ + interface A { + a: number; + b: string; + c?: unknown; + method1?: () => void; + } + + //@ts-expect-error + type Got = PickRequired; +} + +//@ts-expect-error +type X = PickRequired; diff --git a/deno_dist/test/ReturnType.ts b/deno_dist/test/ReturnType.ts new file mode 100644 index 0000000..af6cfef --- /dev/null +++ b/deno_dist/test/ReturnType.ts @@ -0,0 +1,72 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import type { ReturnType } from "../ReturnType.ts"; +import { assert } from "../assert.ts"; +import type { Equals } from "../Equals.ts"; + +{ + const getStringAsync: () => Promise = null as any; + + type Got = ReturnType; + type Expected = string; + + assert>(); +} + +{ + const getString = (): string => { + return null as any; + }; + + type Got = ReturnType; + type Expected = string; + + assert>(); +} + +{ + const getString: () => PromiseLike = null as any; + + type Got = ReturnType; + type Expected = string; + + assert>(); +} + +{ + const getString: () => PromiseLike | number = null as any; + + type Got = ReturnType; + type Expected = string | number; + + assert>(); +} + +{ + //@ts-expect-error + type Got = ReturnType; +} + +{ + //@ts-expect-error + type Got = ReturnType>; +} + +{ + const getString: (() => PromiseLike) | undefined = null as any; + + type Got = ReturnType; + type Expected = string; + + assert>(); +} + +{ + const getString: (() => PromiseLike) | null = null as any; + + type Got = ReturnType; + type Expected = string; + + assert>(); +} diff --git a/deno_dist/test/UnionToIntersection.types.ts b/deno_dist/test/UnionToIntersection.types.ts new file mode 100644 index 0000000..4a9536d --- /dev/null +++ b/deno_dist/test/UnionToIntersection.types.ts @@ -0,0 +1,27 @@ +import type { UnionToIntersection } from "../UnionToIntersection.ts"; +import type { Equals } from "../index.ts"; +import { assert } from "../assert.ts"; + +{ + type A = { foo: string }; + type B = { bar: number }; + + type Got = UnionToIntersection; + type Expected = A & B; + + assert>(); +} + +{ + const o1 = { + "p1": { "a": "foo" }, + "p2": { "b": "foo", "c": "foo" }, + }; + + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const o2: UnionToIntersection = {} as any; + + type Expected = { a: string; b: string; c: string }; + + assert>(); +} diff --git a/deno_dist/test/UnpackPromise.ts b/deno_dist/test/UnpackPromise.ts new file mode 100644 index 0000000..a2731ed --- /dev/null +++ b/deno_dist/test/UnpackPromise.ts @@ -0,0 +1,43 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import type { UnpackPromise } from "../UnpackPromise.ts"; +import { assert } from "../assert.ts"; +import type { Equals } from "../Equals.ts"; + +//@ts-ignore +function test() { + const prT = new Promise(resolve => setTimeout(resolve, 1)); + + type Expected = T; + type Got = UnpackPromise; + + assert>(); +} + +//@ts-ignore +function test() { + const f = async () => { + const out: T = null as any; + return out; + }; + + const prT = f(); + + type Expected = T; + type Got = UnpackPromise; + + assert>(); +} + +{ + type Got = UnpackPromise; + type Expected = never; + + assert>(); +} + +{ + //@ts-expect-error + type Got = UnpackPromise; +} diff --git a/deno_dist/test/UnpackTypeGuard.ts b/deno_dist/test/UnpackTypeGuard.ts new file mode 100644 index 0000000..2e18896 --- /dev/null +++ b/deno_dist/test/UnpackTypeGuard.ts @@ -0,0 +1,15 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import type { UnpackTypeGuard } from "../lab/UnpackTypeGuard.ts"; +import { assert } from "../assert.ts"; +import type { Equals } from "../Equals.ts"; + +{ + const isFoo = (_o: any): _o is "foo" => { + return null as any; + }; + + type Expected = "foo"; + type Got = UnpackTypeGuard; + + assert>(); +} diff --git a/deno_dist/test/assertIs.ts b/deno_dist/test/assertIs.ts new file mode 100644 index 0000000..9dc1ee4 --- /dev/null +++ b/deno_dist/test/assertIs.ts @@ -0,0 +1,49 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import { assert } from "../assert.ts"; +import { is } from "../is.ts"; +import type { Equals } from "../Equals.ts"; + +{ + const x: string | number | boolean = null as any; + + assert(is(x)); + + assert>(); + + console.log("PASS"); +} + +{ + const x: string | number | boolean = null as any; + + assert(!is(x)); + + assert>(); + + console.log("PASS"); +} + +{ + is(null); + + try { + is(null); + throw new Error("FAIL"); + // eslint-disable-next-line no-empty + } catch {} + + console.log("PASS"); +} + +scope: { + try { + assert(undefined); + } catch { + console.log("PASS"); + + break scope; + } + + throw new Error("Fail"); +} diff --git a/deno_dist/test/exclude.ts b/deno_dist/test/exclude.ts new file mode 100644 index 0000000..26664bd --- /dev/null +++ b/deno_dist/test/exclude.ts @@ -0,0 +1,43 @@ +import { exclude } from "../exclude.ts"; +import { assert } from "../assert.ts"; +import { same } from "https://deno.land/x/evt@v2.3.0/tools/inDepth/same.ts"; + +{ + const got = ["a", "b", "c"].filter(exclude("a")); + + const expected = ["b", "c"]; + + assert(same(got, expected)); + + console.log("PASS TEST 1"); +} + +{ + const got = ["a", "b", "c"].filter(exclude(["a"])); + + const expected = ["b", "c"]; + + assert(same(got, expected)); + + console.log("PASS TEST 2"); +} + +{ + const got = [1, 2, 3].filter(exclude("foo")); + + const expected = [1, 2, 3]; + + assert(same(got, expected)); + + console.log("PASS TEST 3"); +} + +{ + const got = ["a", "b", "c", "d"].filter(exclude(["a", "b"])); + + const expected = ["c", "d"]; + + assert(same(got, expected)); + + console.log("PASS TEST 4"); +} diff --git a/deno_dist/test/exclude.types.ts b/deno_dist/test/exclude.types.ts new file mode 100644 index 0000000..46a69f0 --- /dev/null +++ b/deno_dist/test/exclude.types.ts @@ -0,0 +1,38 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import { exclude } from "../exclude.ts"; +import { assert } from "../assert.ts"; +import type { Equals } from "../Equals.ts"; + +{ + const x = (["a", "b", "c"] as const).filter(exclude(["a"])); + + type Got = typeof x; + type Expected = ("b" | "c")[]; + + assert>(); +} + +{ + const x = (["a", "b", "c", "d"] as const).filter(exclude(["a", "b"])); + + type Got = typeof x; + type Expected = ("c" | "d")[]; + + assert>(); +} + +{ + const x = [3, "a", false].filter(exclude([3])); + + type Got = typeof x; + + type Expected = (number | string | boolean)[]; + + assert>(); +} + +{ + //@ts-expect-error + const x = (["a", "b", "c", "d"] as const).filter(exclude("a", "b")); +} diff --git a/deno_dist/test/flip.ts b/deno_dist/test/flip.ts new file mode 100644 index 0000000..79d1b26 --- /dev/null +++ b/deno_dist/test/flip.ts @@ -0,0 +1,142 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { flip } from "../flip.ts"; +import { assert } from "../assert.ts"; + +{ + const obj = { + "is_": true, + "a": 1, + }; + + const expected = false; + + flip(obj, "is_"); + + const got = obj.is_; + + assert(got === expected); + + console.log("PASS TEST 1"); +} + +{ + const obj = { + "is_": true, + }; + + const expected = false; + + const got = flip(obj, "is_"); + + assert(got === expected); + + console.log("PASS TEST 2"); +} + +{ + const obj = { + "a": { + "is_": true, + "aa": 1, + }, + }; + + const expected = false; + + flip(obj.a, "is_"); + + const got = obj.a.is_; + + assert(got === expected); + + console.log("PASS TEST 3"); +} + +{ + interface A { + is_: boolean; + a: number; + } + + const obj: A = { + "a": 1, + "is_": true, + }; + + const expected = false; + + flip(obj, "is_"); + + const got = obj.is_; + + assert(got === expected); + + console.log("PASS TEST 4"); +} + +{ + class A { + is_: boolean; + a: number; + + constructor(is_: boolean, a: number) { + this.is_ = is_; + this.a = a; + } + } + + const obj = new A(true, 1); + + const expected = false; + + flip(obj, "is_"); + + const got = obj.is_; + + assert(got === expected); + + console.log("PASS TEST 5"); +} + +{ + type A = { + is_?: boolean; + a: number; + }; + + const obj: A = { + "a": 1, + "is_": true, + }; + + const expected = false; + + flip(obj, "is_"); + + const got = obj.is_; + + assert(got === expected); + + console.log("PASS TEST 6"); +} + +{ + type A = { + is_?: boolean; + a: number; + }; + + const obj: A = { + "a": 1, + }; + + const expected = undefined; + + flip(obj, "is_"); + + const got = obj.is_; + + assert(got === expected); + + console.log("PASS TEST 7"); +} diff --git a/deno_dist/test/flip.type.ts b/deno_dist/test/flip.type.ts new file mode 100644 index 0000000..2a6fa5e --- /dev/null +++ b/deno_dist/test/flip.type.ts @@ -0,0 +1,26 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import { flip } from "../flip.ts"; + +{ + const obj = { + "is_": true, + "a": 1, + }; + + //@ts-expect-error + flip(obj, "a"); +} + +{ + type A = { + "is_": boolean; + "a"?: number; + }; + + const obj: A = { + "is_": true, + }; + + //@ts-expect-error + flip(obj, "a"); +} diff --git a/deno_dist/test/getProjectRoot.ts b/deno_dist/test/getProjectRoot.ts new file mode 100644 index 0000000..cf41fb0 --- /dev/null +++ b/deno_dist/test/getProjectRoot.ts @@ -0,0 +1,3 @@ +import { getProjectRoot } from "../tools/getProjectRoot.ts"; + +console.log(`Project root path: ${getProjectRoot()} does it seems right ? If yes then PASS`); diff --git a/deno_dist/test/id.ts b/deno_dist/test/id.ts new file mode 100644 index 0000000..5edd8c7 --- /dev/null +++ b/deno_dist/test/id.ts @@ -0,0 +1,20 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import { id } from "../id.ts"; + +{ + type Square = { + type: "SQUARE"; + side: number; + }; + + type Circle = { + type: "CIRCLE"; + radius: number; + }; + + id({ "type": "SQUARE", "side": 12 }); + + //@ts-expect-error + id({ "type": "SQUARE", "side": 12 }); +} diff --git a/deno_dist/test/index.ts b/deno_dist/test/index.ts new file mode 100644 index 0000000..1db3ffb --- /dev/null +++ b/deno_dist/test/index.ts @@ -0,0 +1,92 @@ +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; +})(); + +const __filename = (() => { + const { url: urlStr } = import.meta; + const url = new URL(urlStr); + const __filename = (url.protocol === "file:" ? url.pathname : urlStr); + + 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; +})(); + +//This will not run on deno, we need a separate test runner for Deno (./mod.ts). + +import * as child_process from "node:child_process"; +import * as path from "node:path"; +import { Deferred } from "https://deno.land/x/evt@v2.3.0/tools/Deferred.ts"; + +const names = ["withDefault", "flip", "objectKeys", "isPromiseLike", "assertIs", "exclude"]; + +(async () => { + if (!!process.env.FORK) { + process.once("unhandledRejection", error => { + throw error; + }); + + require(process.env.FORK); + + return; + } + + for (const name of names) { + console.log(`Running: ${name}`); + + const dExitCode = new Deferred(); + + child_process + .fork(__filename, undefined, { + "env": { "FORK": path.join(__dirname, name) }, + }) + .on("message", console.log) + .once("exit", code => dExitCode.resolve(code ?? 1)); + + const exitCode = await dExitCode.pr; + + if (exitCode !== 0) { + console.log(`${name} exited with error code: ${exitCode}`); + process.exit(exitCode); + } + + console.log("\n"); + } +})(); diff --git a/deno_dist/test/isPromiseLike.ts b/deno_dist/test/isPromiseLike.ts new file mode 100644 index 0000000..9aee073 --- /dev/null +++ b/deno_dist/test/isPromiseLike.ts @@ -0,0 +1,94 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { isPromiseLike } from "../isPromiseLike.ts"; +import { assert } from "../assert.ts"; + +{ + const x = new Promise(resolve => setTimeout(() => resolve, 1000)); + + const got = isPromiseLike(x); + + assert(got === true); + + console.log("PASS TEST 1"); +} + +{ + const x = { + "then": () => null, + "a": 1, + "b": "foo", + "c": null, + }; + + assert(isPromiseLike(x)); + + console.log("PASS TEST 2"); +} + +{ + const x = async () => { + return 1; + }; + + assert(isPromiseLike(x())); + + console.log("PASS TEST 3"); +} + +{ + const x = async () => { + return 1; + }; + + assert(!isPromiseLike(x)); + + console.log("PASS TESt 4"); +} + +{ + const x: PromiseLike = { + "then": () => null as any, + }; + + assert(isPromiseLike(x)); + + console.log("PASS TEST 5"); +} + +{ + const x = false; + + assert(!isPromiseLike(x)); + + console.log("PASS TEST 6"); +} + +{ + class X { + then: () => void; + + constructor(then: () => void) { + this.then = then; + } + } + + const x = new X(() => null); + + assert(isPromiseLike(x)); + + console.log("PASS TEST 7"); +} + +{ + interface X { + then: () => void; + } + + const x: X = { + "then": () => null, + }; + + assert(isPromiseLike(x)); + + console.log("PASS TEST 8"); +} diff --git a/deno_dist/test/mod.ts b/deno_dist/test/mod.ts new file mode 100644 index 0000000..82569e5 --- /dev/null +++ b/deno_dist/test/mod.ts @@ -0,0 +1,5 @@ +import "./withDefault.ts"; +import "./flip.ts"; +import "./objectKeys.ts"; +import "./isPromiseLike.ts"; +import "./assertIs.ts"; diff --git a/deno_dist/test/objectEntries.types.ts b/deno_dist/test/objectEntries.types.ts new file mode 100644 index 0000000..0e0d682 --- /dev/null +++ b/deno_dist/test/objectEntries.types.ts @@ -0,0 +1,78 @@ +import type { Equals, ObjectEntries } from "../index.ts"; +import { objectEntries } from "../objectEntries.ts"; +import { assert } from "../assert.ts"; +import { Reflect } from "../Reflect.ts"; + +{ + const input = Reflect<{ + a: string; + b: number; + c: boolean; + }>(); + + const got = objectEntries(input); + + type Expected = (["a", string] | ["b", number] | ["c", boolean])[]; + + assert>(); +} + +{ + const input = Reflect<{ + a?: string; + b: number; + c: boolean; + }>(); + + const got = objectEntries(input); + + type Expected = (["a", string | undefined] | ["b", number] | ["c", boolean])[]; + + assert>(); +} + +{ + const input = { + "a": "foo", + "b": 33, + "c": true, + } as const; + + assert>(); + + const got = objectEntries(input); + + type Expected = (["a", "foo"] | ["b", 33] | ["c", true])[]; + + assert>(); +} + +{ + const input = {}; + + const got = objectEntries(input); + + type Expected = never[]; + + assert>(); +} + +{ + type Input = { a: string; b: number; c: boolean }; + + type Got = ObjectEntries; + + type Expected = (["a", string] | ["b", number] | ["c", boolean])[]; + + assert>(); +} + +{ + type Input = { a?: string; b: number; c: boolean }; + + type Got = ObjectEntries; + + type Expected = (["a", string | undefined] | ["b", number] | ["c", boolean])[]; + + assert>(); +} diff --git a/deno_dist/test/objectFromEntries.types.ts b/deno_dist/test/objectFromEntries.types.ts new file mode 100644 index 0000000..c6f1e73 --- /dev/null +++ b/deno_dist/test/objectFromEntries.types.ts @@ -0,0 +1,62 @@ +import type { Equals, ObjectFromEntries } from "../index.ts"; +import { objectFromEntries } from "../objectFromEntries.ts"; +import { assert } from "../assert.ts"; +import { id } from "../id.ts"; + +{ + const entries = [ + ["a", "foo"], + ["b", 33], + ["c", true], + ] as const; + + const obj = objectFromEntries(entries); + + assert< + Equals< + typeof obj, + { + a: "foo"; + b: 33; + c: true; + } + > + >(); +} + +{ + const entries = [ + ["a", id("foo")], + ["b", id(33)], + ["c", id(true)], + ] as const; + + const obj = objectFromEntries(entries); + + assert< + Equals< + typeof obj, + { + a: string; + b: number; + c: boolean; + } + > + >(); +} + +{ + type Entry = readonly ["a", string] | readonly ["b", number]; + + type O = ObjectFromEntries; + + assert< + Equals< + O, + { + a: string; + b: number; + } + > + >(); +} diff --git a/deno_dist/test/objectKeys.ts b/deno_dist/test/objectKeys.ts new file mode 100644 index 0000000..2e547fc --- /dev/null +++ b/deno_dist/test/objectKeys.ts @@ -0,0 +1,41 @@ +import { objectKeys } from "../objectKeys.ts"; +import { assert } from "../assert.ts"; +import { same } from "https://deno.land/x/evt@v2.3.0/tools/inDepth/same.ts"; + +{ + type A = { + a: number; + b: number; + c: number; + }; + + const obj: A = { + "a": 1, + "b": 2, + "c": 3, + }; + + const got = objectKeys(obj); + + const expected = ["a", "b", "c"]; + + assert(same(got, expected)); + + console.log("PASS TEST 1"); +} + +{ + const obj = { + "a": 1, + "b": 2, + "c": 3, + }; + + const got = objectKeys<{ a: number; b: number }>(obj); + + const expected = ["a", "b", "c"]; + + assert(same(got, expected)); + + console.log("PASS TEST 2"); +} diff --git a/deno_dist/test/objectKeys.types.ts b/deno_dist/test/objectKeys.types.ts new file mode 100644 index 0000000..1b6aa7e --- /dev/null +++ b/deno_dist/test/objectKeys.types.ts @@ -0,0 +1,111 @@ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import { objectKeys } from "../objectKeys.ts"; +import { assert } from "../assert.ts"; +import type { Equals } from "../Equals.ts"; + +{ + const obj = { + "a": 1, + "b": "ok", + "c": null, + }; + + const x = objectKeys(obj); + + type Expected = ("a" | "b" | "c")[]; + + type Got = typeof x; + + assert>(); +} + +{ + type A = { + a: number; + b: string; + c: null; + }; + const obj: A = { + "a": 1, + "b": "ok", + "c": null, + }; + + const x = objectKeys<{ a: number; b: string }>(obj); + + type Expected = ("a" | "b")[]; + + type Got = typeof x; + + assert>(); +} + +{ + interface A { + a: number; + b: string; + c: null; + } + + const obj: A = { + "a": 1, + "b": "ok", + "c": null, + }; + + //@ts-expect-error + const x = objectKeys(obj); +} + +{ + class A { + a: number; + b: string; + c: null; + + constructor(a: number, b: string, c: null) { + this.a = a; + this.b = b; + this.c = c; + } + } + + const obj: A = new A(1, "ok", null); + + //@ts-expect-error + const x = objectKeys(obj); +} + +{ + const obj = {}; + + const x = objectKeys(obj); + + type Expected = never[]; + + type Got = typeof x; + + assert>(); +} + +{ + const x = "ok"; + + //@ts-expect-error + const got = objectKeys(x); +} + +{ + const x = 1; + + //@ts-expect-error + const got = objectKeys(x); +} + +{ + const x = true; + + //@ts-expect-error + const got = objectKeys(x); +} diff --git a/deno_dist/test/withDefault.ts b/deno_dist/test/withDefault.ts new file mode 100644 index 0000000..f4e5195 --- /dev/null +++ b/deno_dist/test/withDefault.ts @@ -0,0 +1,120 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import { withDefaults } from "../lab/withDefaults.ts"; +import { same } from "https://deno.land/x/evt@v2.3.0/tools/inDepth/same.ts"; +import { assert } from "../assert.ts"; + +{ + const f = (params: { foo: string; bar: number }): string => { + const { foo, bar } = params; + return `${foo} ${bar}`; + }; + + const got = withDefaults(f, { "foo": "xxx" })({ "bar": 44 }); + + const expected = `xxx 44`; + + assert(got === expected); + + console.log("PASS TEST 1"); +} + +{ + const f = (params: { a: number; b: number }) => { + return params; + }; + + const got = withDefaults(f, { "a": 44 })({ "defaultsOverwrite": { "a": [33] }, "b": 22 }); + + const expected = { + "a": 33, + "b": 22, + }; + + assert(same(got, expected)); + + console.log("PASS TEST 2"); +} + +{ + const f = (params: { a?: number; b?: number }) => { + return params; + }; + + const got = withDefaults(f, { "a": 44 })({}); + const expected = { + "a": 44, + "b": undefined, + }; + + assert(same(got, expected)); + + console.log("PASS TEST 3"); +} + +{ + const f = (params: { a: number; b: number }) => { + const { a, b } = params; + return `${a}${b}`; + }; + + const fWd = withDefaults(f, { "a": 44 }); + + const got = fWd({ "b": 33 }) + fWd({ "b": 12 }); + + const expected = "44334412"; + + assert(got === expected); + + console.log("PASS TEST 4"); +} + +{ + const f = (params: { a: number; b: number }) => { + const { a, b } = params; + return `${a}${b}`; + }; + + const fWd = withDefaults(f, { "a": 44 }); + const got = fWd({ "defaultsOverwrite": { "a": undefined }, "b": 33 }); + const expected = "4433"; + + assert(got === expected); + + console.log("PASS TEST 5"); +} + +{ + const f = (params: { a: number | undefined; b: number }) => { + return params; + }; + + const fWd = withDefaults(f, { "a": 33 }); + + const got = fWd({ "b": 44, "defaultsOverwrite": { "a": [undefined] } }); + const expected = { + "a": undefined, + "b": 44, + }; + + assert(same(got, expected)); + + console.log("PASS TEST 6"); +} + +{ + const f = (params: { a?: number; b: number }) => { + return params; + }; + + const fWd = withDefaults(f, { "a": 33 }); + + const got = fWd({ "b": 44, "defaultsOverwrite": { "a": [undefined] } }); + const expected = { + "a": undefined, + "b": 44, + }; + + assert(same(got, expected)); + + console.log("PASS TEST 7"); +} diff --git a/deno_dist/test/withDefaults.types.ts b/deno_dist/test/withDefaults.types.ts new file mode 100644 index 0000000..d1d27d6 --- /dev/null +++ b/deno_dist/test/withDefaults.types.ts @@ -0,0 +1,108 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +import { assert } from "../assert.ts"; +import { withDefaults } from "../lab/withDefaults.ts"; +import type { Equals } from "../Equals.ts"; + +const x: () => T = null as any; + +//@ts-ignore +function test() { + const f: (params: { foo: T | undefined; bar: U }) => V = x(); + const got = withDefaults(f, { "foo": x() }); + + const expected: ( + params: { + bar: U; + } & { + defaultsOverwrite?: { + foo?: [T | undefined]; + }; + }, + ) => V = x(); + + assert>(); +} + +//@ts-ignore +function test() { + const f: (params: { foo: T; bar: U }) => V = x(); + const got = withDefaults(f, { "foo": x() }); + + const expected: ( + params: { + bar: U; + } & { + defaultsOverwrite?: { + foo?: [T]; + }; + }, + ) => V = x(); + + assert>(); +} + +//@ts-ignore +function test() { + const f: (params: { foo?: T; bar: U }) => V = x(); + const got = withDefaults(f, { "foo": x() }); + + const expected: ( + params: { + bar: U; + } & { + defaultsOverwrite?: { + foo?: [T | undefined]; + }; + }, + ) => V = x(); + + assert>(); +} + +//@ts-ignore +function test() { + // eslint-disable-next-line @typescript-eslint/ban-types + const f: (params: {}) => T = null as any; + + //@ts-expect-error + withDefaults(f, { "foo": null as any }); +} + +//@ts-ignore +function test() { + // eslint-disable-next-line @typescript-eslint/ban-types + const f: (params: { bar: number }) => T = null as any; + + //@ts-expect-error + withDefaults(f, { "foo": null as any }); +} + +//@ts-ignore +function test() { + // eslint-disable-next-line @typescript-eslint/ban-types + const f: (params: {}) => T = null as any; + + withDefaults(f, {}); +} + +//@ts-ignore +function test() { + // eslint-disable-next-line @typescript-eslint/ban-types + const f: (params: { foo: number; bar: string }) => T = null as any; + + //@ts-expect-error + withDefaults(f, { "foo": null as any, "baz": "" }); +} + +//@ts-ignore +function test() { + const f: (params: { a: U; b: T }) => V = x(); + + const fWd = withDefaults(f, { "a": x() }); + + //@ts-expect-error + const got = fWd({ "b": x(), "defaultsOverwrite": { "a": [undefined] } }); +} 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/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/esm/Equals.d.ts b/esm/Equals.d.ts new file mode 100644 index 0000000..60841a0 --- /dev/null +++ b/esm/Equals.d.ts @@ -0,0 +1,4 @@ +import type { Unite } from "./tools/Unite.mjs"; +import type { StrictEquals } from "./tools/StrictEquals.mjs"; +/** https://docs.tsafe.dev/main/equals */ +export type Equals = StrictEquals, Unite>; diff --git a/esm/Equals.mjs b/esm/Equals.mjs new file mode 100644 index 0000000..5b90a2f --- /dev/null +++ b/esm/Equals.mjs @@ -0,0 +1,3 @@ +export {}; +// Credit https://stackoverflow.com/a/52473108/3570903 +//# sourceMappingURL=Equals.mjs.map \ No newline at end of file diff --git a/esm/Equals.mjs.map b/esm/Equals.mjs.map new file mode 100644 index 0000000..fdefe73 --- /dev/null +++ b/esm/Equals.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"Equals.mjs","sourceRoot":"","sources":["../src/Equals.ts"],"names":[],"mappings":";AAOA,sDAAsD"} \ No newline at end of file diff --git a/esm/Extends.d.ts b/esm/Extends.d.ts new file mode 100644 index 0000000..da4e778 --- /dev/null +++ b/esm/Extends.d.ts @@ -0,0 +1,7 @@ +import { StrictEquals } from "./tools/StrictEquals.mjs"; +/** + * @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/esm/Extends.mjs b/esm/Extends.mjs new file mode 100644 index 0000000..54acd6e --- /dev/null +++ b/esm/Extends.mjs @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=Extends.mjs.map \ No newline at end of file diff --git a/esm/Extends.mjs.map b/esm/Extends.mjs.map new file mode 100644 index 0000000..1e5d013 --- /dev/null +++ b/esm/Extends.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"Extends.mjs","sourceRoot":"","sources":["../src/Extends.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/esm/MethodNames.d.ts b/esm/MethodNames.d.ts new file mode 100644 index 0000000..4f55fc6 --- /dev/null +++ b/esm/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/esm/MethodNames.mjs b/esm/MethodNames.mjs new file mode 100644 index 0000000..51393f7 --- /dev/null +++ b/esm/MethodNames.mjs @@ -0,0 +1,4 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/ban-types */ +export {}; +//# sourceMappingURL=MethodNames.mjs.map \ No newline at end of file diff --git a/esm/MethodNames.mjs.map b/esm/MethodNames.mjs.map new file mode 100644 index 0000000..990a42b --- /dev/null +++ b/esm/MethodNames.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"MethodNames.mjs","sourceRoot":"","sources":["../src/MethodNames.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,iDAAiD"} \ No newline at end of file diff --git a/esm/Not.d.ts b/esm/Not.d.ts new file mode 100644 index 0000000..c5bd642 --- /dev/null +++ b/esm/Not.d.ts @@ -0,0 +1,2 @@ +/** https://docs.tsafe.dev/main/not */ +export type Not = B extends true ? false : true; diff --git a/esm/Not.mjs b/esm/Not.mjs new file mode 100644 index 0000000..29d8daf --- /dev/null +++ b/esm/Not.mjs @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=Not.mjs.map \ No newline at end of file diff --git a/esm/Not.mjs.map b/esm/Not.mjs.map new file mode 100644 index 0000000..ebc51f1 --- /dev/null +++ b/esm/Not.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"Not.mjs","sourceRoot":"","sources":["../src/Not.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/esm/Param0.d.ts b/esm/Param0.d.ts new file mode 100644 index 0000000..c9c3f68 --- /dev/null +++ b/esm/Param0.d.ts @@ -0,0 +1,7 @@ +import type { Parameters } from "./Parameters.mjs"; +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/esm/Param0.mjs b/esm/Param0.mjs new file mode 100644 index 0000000..4953004 --- /dev/null +++ b/esm/Param0.mjs @@ -0,0 +1,3 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +export {}; +//# sourceMappingURL=Param0.mjs.map \ No newline at end of file diff --git a/esm/Param0.mjs.map b/esm/Param0.mjs.map new file mode 100644 index 0000000..5bc5ce5 --- /dev/null +++ b/esm/Param0.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"Param0.mjs","sourceRoot":"","sources":["../src/Param0.ts"],"names":[],"mappings":"AAAA,uDAAuD"} \ No newline at end of file diff --git a/esm/Parameters.d.ts b/esm/Parameters.d.ts new file mode 100644 index 0000000..dfc7e7c --- /dev/null +++ b/esm/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/esm/Parameters.mjs b/esm/Parameters.mjs new file mode 100644 index 0000000..6dfb318 --- /dev/null +++ b/esm/Parameters.mjs @@ -0,0 +1,3 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +export {}; +//# sourceMappingURL=Parameters.mjs.map \ No newline at end of file diff --git a/esm/Parameters.mjs.map b/esm/Parameters.mjs.map new file mode 100644 index 0000000..8ef4954 --- /dev/null +++ b/esm/Parameters.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"Parameters.mjs","sourceRoot":"","sources":["../src/Parameters.ts"],"names":[],"mappings":"AAAA,uDAAuD"} \ No newline at end of file diff --git a/esm/PickOptionals.d.ts b/esm/PickOptionals.d.ts new file mode 100644 index 0000000..dac7923 --- /dev/null +++ b/esm/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/esm/PickOptionals.mjs b/esm/PickOptionals.mjs new file mode 100644 index 0000000..e05c826 --- /dev/null +++ b/esm/PickOptionals.mjs @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=PickOptionals.mjs.map \ No newline at end of file diff --git a/esm/PickOptionals.mjs.map b/esm/PickOptionals.mjs.map new file mode 100644 index 0000000..fbb2dea --- /dev/null +++ b/esm/PickOptionals.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"PickOptionals.mjs","sourceRoot":"","sources":["../src/PickOptionals.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/esm/PickRequired.d.ts b/esm/PickRequired.d.ts new file mode 100644 index 0000000..1ccc735 --- /dev/null +++ b/esm/PickRequired.d.ts @@ -0,0 +1,7 @@ +import { PickOptionals } from "./PickOptionals.mjs"; +/** + * PickRequired<{ p1: string; p2?: string; p3?: number; p4: string; }> + * is the type + * { p1: string; p4: number; } + */ +export type PickRequired> = Omit>; diff --git a/esm/PickRequired.mjs b/esm/PickRequired.mjs new file mode 100644 index 0000000..8a0a6fb --- /dev/null +++ b/esm/PickRequired.mjs @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=PickRequired.mjs.map \ No newline at end of file diff --git a/esm/PickRequired.mjs.map b/esm/PickRequired.mjs.map new file mode 100644 index 0000000..bbeb42f --- /dev/null +++ b/esm/PickRequired.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"PickRequired.mjs","sourceRoot":"","sources":["../src/PickRequired.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/esm/Reflect.d.ts b/esm/Reflect.d.ts new file mode 100644 index 0000000..fa64428 --- /dev/null +++ b/esm/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/esm/Reflect.mjs b/esm/Reflect.mjs new file mode 100644 index 0000000..145ec31 --- /dev/null +++ b/esm/Reflect.mjs @@ -0,0 +1,6 @@ +/** Always return null but pretends it returns an object of type T */ +export function Reflect() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return null; +} +//# sourceMappingURL=Reflect.mjs.map \ No newline at end of file diff --git a/esm/Reflect.mjs.map b/esm/Reflect.mjs.map new file mode 100644 index 0000000..7cd0da7 --- /dev/null +++ b/esm/Reflect.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"Reflect.mjs","sourceRoot":"","sources":["../src/Reflect.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,UAAU,OAAO;IACnB,8DAA8D;IAC9D,OAAO,IAAW,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/esm/ReturnType.d.ts b/esm/ReturnType.d.ts new file mode 100644 index 0000000..0e00b32 --- /dev/null +++ b/esm/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/esm/ReturnType.mjs b/esm/ReturnType.mjs new file mode 100644 index 0000000..c154a5f --- /dev/null +++ b/esm/ReturnType.mjs @@ -0,0 +1,9 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +export {}; +// 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.mjs.map \ No newline at end of file diff --git a/esm/ReturnType.mjs.map b/esm/ReturnType.mjs.map new file mode 100644 index 0000000..da716c6 --- /dev/null +++ b/esm/ReturnType.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"ReturnType.mjs","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/esm/UnionToIntersection.d.ts b/esm/UnionToIntersection.d.ts new file mode 100644 index 0000000..e1118a1 --- /dev/null +++ b/esm/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/esm/UnionToIntersection.mjs b/esm/UnionToIntersection.mjs new file mode 100644 index 0000000..d024430 --- /dev/null +++ b/esm/UnionToIntersection.mjs @@ -0,0 +1,3 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +export {}; +//# sourceMappingURL=UnionToIntersection.mjs.map \ No newline at end of file diff --git a/esm/UnionToIntersection.mjs.map b/esm/UnionToIntersection.mjs.map new file mode 100644 index 0000000..46f38b7 --- /dev/null +++ b/esm/UnionToIntersection.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"UnionToIntersection.mjs","sourceRoot":"","sources":["../src/UnionToIntersection.ts"],"names":[],"mappings":"AAAA,uDAAuD"} \ No newline at end of file diff --git a/esm/UnpackPromise.d.ts b/esm/UnpackPromise.d.ts new file mode 100644 index 0000000..826dad4 --- /dev/null +++ b/esm/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/esm/UnpackPromise.mjs b/esm/UnpackPromise.mjs new file mode 100644 index 0000000..4a60ac6 --- /dev/null +++ b/esm/UnpackPromise.mjs @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=UnpackPromise.mjs.map \ No newline at end of file diff --git a/esm/UnpackPromise.mjs.map b/esm/UnpackPromise.mjs.map new file mode 100644 index 0000000..00a4d71 --- /dev/null +++ b/esm/UnpackPromise.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"UnpackPromise.mjs","sourceRoot":"","sources":["../src/UnpackPromise.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/esm/assert.d.ts b/esm/assert.d.ts new file mode 100644 index 0000000..52cabd9 --- /dev/null +++ b/esm/assert.d.ts @@ -0,0 +1,7 @@ +export type { Equals } from "./Equals.mjs"; +/** @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/esm/assert.mjs b/esm/assert.mjs new file mode 100644 index 0000000..675cd81 --- /dev/null +++ b/esm/assert.mjs @@ -0,0 +1,79 @@ +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; +}; +/* eslint-disable @typescript-eslint/no-unused-vars */ +import { overwriteReadonlyProp } from "./lab/overwriteReadonlyProp.mjs"; +import { assertIsRefWrapper } from "./zz_internal/assertIsRefWrapper.mjs"; +/** @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 { + 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)); +export { AssertionError }; +/** https://docs.tsafe.dev/assert */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function assert(condition, msg) { + if (arguments.length === 0) { + condition = true; + } + if (assertIsRefWrapper.ref !== undefined) { + assertIsRefWrapper.ref = undefined; + return; + } + if (!condition) { + throw new AssertionError(msg); + } +} +//# sourceMappingURL=assert.mjs.map \ No newline at end of file diff --git a/esm/assert.mjs.map b/esm/assert.mjs.map new file mode 100644 index 0000000..09fd859 --- /dev/null +++ b/esm/assert.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"assert.mjs","sourceRoot":"","sources":["../src/assert.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAsD;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;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,qBAAqB,CACjB,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;;AAED,oCAAoC;AACpC,8DAA8D;AAC9D,MAAM,UAAU,MAAM,CAAkB,SAAe,EAAE,GAAY;IACjE,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,SAAS,GAAG,IAAI,CAAC;KACpB;IACD,IAAI,kBAAkB,CAAC,GAAG,KAAK,SAAS,EAAE;QACtC,kBAAkB,CAAC,GAAG,GAAG,SAAS,CAAC;QACnC,OAAO;KACV;IAED,IAAI,CAAC,SAAS,EAAE;QACZ,MAAM,IAAI,cAAc,CAAC,GAAG,CAAC,CAAC;KACjC;AACL,CAAC"} \ No newline at end of file diff --git a/esm/capitalize.d.ts b/esm/capitalize.d.ts new file mode 100644 index 0000000..cbd5235 --- /dev/null +++ b/esm/capitalize.d.ts @@ -0,0 +1,2 @@ +/** @see */ +export declare function capitalize(str: S): Capitalize; diff --git a/esm/capitalize.mjs b/esm/capitalize.mjs new file mode 100644 index 0000000..d45ad5b --- /dev/null +++ b/esm/capitalize.mjs @@ -0,0 +1,6 @@ +/** @see */ +export function capitalize(str) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (str.charAt(0).toUpperCase() + str.slice(1)); +} +//# sourceMappingURL=capitalize.mjs.map \ No newline at end of file diff --git a/esm/capitalize.mjs.map b/esm/capitalize.mjs.map new file mode 100644 index 0000000..0bd9d34 --- /dev/null +++ b/esm/capitalize.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"capitalize.mjs","sourceRoot":"","sources":["../src/capitalize.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,MAAM,UAAU,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"} \ No newline at end of file diff --git a/esm/exclude.d.ts b/esm/exclude.d.ts new file mode 100644 index 0000000..909ca29 --- /dev/null +++ b/esm/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/esm/exclude.mjs b/esm/exclude.mjs new file mode 100644 index 0000000..090817f --- /dev/null +++ b/esm/exclude.mjs @@ -0,0 +1,15 @@ +/* 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) { + var test = target instanceof Object + ? function (element) { return target.indexOf(element) < 0; } + : function (element) { return element !== target; }; + return function (str) { + return test(str); + }; +} +//# sourceMappingURL=exclude.mjs.map \ No newline at end of file diff --git a/esm/exclude.mjs.map b/esm/exclude.mjs.map new file mode 100644 index 0000000..69a1854 --- /dev/null +++ b/esm/exclude.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"exclude.mjs","sourceRoot":"","sources":["../src/exclude.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD;;;;GAIG;AACH,MAAM,UAAU,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"} \ No newline at end of file diff --git a/esm/flip.d.ts b/esm/flip.d.ts new file mode 100644 index 0000000..54c63f2 --- /dev/null +++ b/esm/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/esm/flip.mjs b/esm/flip.mjs new file mode 100644 index 0000000..3040052 --- /dev/null +++ b/esm/flip.mjs @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** + * 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, prop) { + if (object[prop] === undefined) { + return; + } + return (object[prop] = !object[prop]); +} +//# sourceMappingURL=flip.mjs.map \ No newline at end of file diff --git a/esm/flip.mjs.map b/esm/flip.mjs.map new file mode 100644 index 0000000..5ec154b --- /dev/null +++ b/esm/flip.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"flip.mjs","sourceRoot":"","sources":["../src/flip.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAQvD;;;;GAIG;AACH,MAAM,UAAU,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"} \ No newline at end of file diff --git a/esm/id.d.ts b/esm/id.d.ts new file mode 100644 index 0000000..e3e6d46 --- /dev/null +++ b/esm/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/esm/id.mjs b/esm/id.mjs new file mode 100644 index 0000000..e8f6c8b --- /dev/null +++ b/esm/id.mjs @@ -0,0 +1,3 @@ +/** https://docs.tsafe.dev/id */ +export var id = function (x) { return x; }; +//# sourceMappingURL=id.mjs.map \ No newline at end of file diff --git a/esm/id.mjs.map b/esm/id.mjs.map new file mode 100644 index 0000000..3b5fa69 --- /dev/null +++ b/esm/id.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"id.mjs","sourceRoot":"","sources":["../src/id.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,MAAM,CAAC,IAAM,EAAE,GAAG,UAAI,CAAI,IAAK,OAAA,CAAC,EAAD,CAAC,CAAC"} \ No newline at end of file diff --git a/esm/index.d.ts b/esm/index.d.ts new file mode 100644 index 0000000..6ba1c86 --- /dev/null +++ b/esm/index.d.ts @@ -0,0 +1,25 @@ +export * from "./assert.mjs"; +export * from "./exclude.mjs"; +export * from "./flip.mjs"; +export * from "./id.mjs"; +export * from "./isPromiseLike.mjs"; +export type { MethodNames } from "./MethodNames.mjs"; +export * from "./objectKeys.mjs"; +export type { Parameters } from "./Parameters.mjs"; +export type { Param0 } from "./Param0.mjs"; +export type { PickOptionals } from "./PickOptionals.mjs"; +export type { PickRequired } from "./PickRequired.mjs"; +export type { ReturnType } from "./ReturnType.mjs"; +export * from "./typeGuard.mjs"; +export type { UnpackPromise } from "./UnpackPromise.mjs"; +export * from "./is.mjs"; +export type { Equals } from "./Equals.mjs"; +export type { Extends } from "./Extends.mjs"; +export type { Not } from "./Not.mjs"; +export type { UnionToIntersection } from "./UnionToIntersection.mjs"; +export * from "./objectEntries.mjs"; +export * from "./objectFromEntries.mjs"; +export * from "./noUndefined.mjs"; +export * from "./Reflect.mjs"; +export * from "./capitalize.mjs"; +export * from "./uncapitalize.mjs"; diff --git a/esm/index.mjs b/esm/index.mjs new file mode 100644 index 0000000..c0d6207 --- /dev/null +++ b/esm/index.mjs @@ -0,0 +1,15 @@ +export * from "./assert.mjs"; +export * from "./exclude.mjs"; +export * from "./flip.mjs"; +export * from "./id.mjs"; +export * from "./isPromiseLike.mjs"; +export * from "./objectKeys.mjs"; +export * from "./typeGuard.mjs"; +export * from "./is.mjs"; +export * from "./objectEntries.mjs"; +export * from "./objectFromEntries.mjs"; +export * from "./noUndefined.mjs"; +export * from "./Reflect.mjs"; +export * from "./capitalize.mjs"; +export * from "./uncapitalize.mjs"; +//# sourceMappingURL=index.mjs.map \ No newline at end of file diff --git a/esm/index.mjs.map b/esm/index.mjs.map new file mode 100644 index 0000000..51e76f5 --- /dev/null +++ b/esm/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,MAAM,CAAC;AACrB,cAAc,iBAAiB,CAAC;AAEhC,cAAc,cAAc,CAAC;AAM7B,cAAc,aAAa,CAAC;AAE5B,cAAc,MAAM,CAAC;AAKrB,cAAc,iBAAiB,CAAC;AAChC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC"} \ No newline at end of file diff --git a/esm/is.d.ts b/esm/is.d.ts new file mode 100644 index 0000000..076cac5 --- /dev/null +++ b/esm/is.d.ts @@ -0,0 +1 @@ +export declare function is(_value: any): _value is T; diff --git a/esm/is.mjs b/esm/is.mjs new file mode 100644 index 0000000..57033cb --- /dev/null +++ b/esm/is.mjs @@ -0,0 +1,22 @@ +/* eslint-disable @typescript-eslint/no-namespace */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { assertIsRefWrapper } from "./zz_internal/assertIsRefWrapper.mjs"; +var errorMessage = [ + "Wrong usage of the ".concat(is.name, " function refer to"), + "https://docs.tsafe.dev/".concat(is.name.toLowerCase()), +].join(" "); +export function is(_value) { + var ref = {}; + if (assertIsRefWrapper.ref !== undefined) { + assertIsRefWrapper.ref = undefined; + throw new Error(errorMessage); + } + assertIsRefWrapper.ref = ref; + Promise.resolve().then(function () { + if (assertIsRefWrapper.ref === ref) { + throw new Error(errorMessage); + } + }); + return null; +} +//# sourceMappingURL=is.mjs.map \ No newline at end of file diff --git a/esm/is.mjs.map b/esm/is.mjs.map new file mode 100644 index 0000000..1401052 --- /dev/null +++ b/esm/is.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"is.mjs","sourceRoot":"","sources":["../src/is.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,uDAAuD;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;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,MAAM,UAAU,EAAE,CAAI,MAAW;IAC7B,IAAM,GAAG,GAAG,EAAE,CAAC;IAEf,IAAI,kBAAkB,CAAC,GAAG,KAAK,SAAS,EAAE;QACtC,kBAAkB,CAAC,GAAG,GAAG,SAAS,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;KACjC;IAED,kBAAkB,CAAC,GAAG,GAAG,GAAG,CAAC;IAE7B,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC;QACnB,IAAI,kBAAkB,CAAC,GAAG,KAAK,GAAG,EAAE;YAChC,MAAM,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;SACjC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,IAAW,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/esm/isPromiseLike.d.ts b/esm/isPromiseLike.d.ts new file mode 100644 index 0000000..e881cb9 --- /dev/null +++ b/esm/isPromiseLike.d.ts @@ -0,0 +1 @@ +export declare function isPromiseLike(o: any): o is PromiseLike; diff --git a/esm/isPromiseLike.mjs b/esm/isPromiseLike.mjs new file mode 100644 index 0000000..63244d2 --- /dev/null +++ b/esm/isPromiseLike.mjs @@ -0,0 +1,5 @@ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export function isPromiseLike(o) { + return typeof (o === null || o === void 0 ? void 0 : o.then) === "function"; +} +//# sourceMappingURL=isPromiseLike.mjs.map \ No newline at end of file diff --git a/esm/isPromiseLike.mjs.map b/esm/isPromiseLike.mjs.map new file mode 100644 index 0000000..1aa5951 --- /dev/null +++ b/esm/isPromiseLike.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"isPromiseLike.mjs","sourceRoot":"","sources":["../src/isPromiseLike.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,MAAM,UAAU,aAAa,CAAW,CAAM;IAC1C,OAAO,OAAO,CAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,IAAI,CAAA,KAAK,UAAU,CAAC;AACzC,CAAC"} \ No newline at end of file diff --git a/esm/lab/PromiseOrNot.d.ts b/esm/lab/PromiseOrNot.d.ts new file mode 100644 index 0000000..5ad9139 --- /dev/null +++ b/esm/lab/PromiseOrNot.d.ts @@ -0,0 +1 @@ +export type PromiseOrNot = PromiseLike | T; diff --git a/esm/lab/PromiseOrNot.mjs b/esm/lab/PromiseOrNot.mjs new file mode 100644 index 0000000..9dc1664 --- /dev/null +++ b/esm/lab/PromiseOrNot.mjs @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=PromiseOrNot.mjs.map \ No newline at end of file diff --git a/esm/lab/PromiseOrNot.mjs.map b/esm/lab/PromiseOrNot.mjs.map new file mode 100644 index 0000000..f397bc6 --- /dev/null +++ b/esm/lab/PromiseOrNot.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"PromiseOrNot.mjs","sourceRoot":"","sources":["../../src/lab/PromiseOrNot.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/esm/lab/UnpackTypeGuard.d.ts b/esm/lab/UnpackTypeGuard.d.ts new file mode 100644 index 0000000..af4fc37 --- /dev/null +++ b/esm/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/esm/lab/UnpackTypeGuard.mjs b/esm/lab/UnpackTypeGuard.mjs new file mode 100644 index 0000000..d674ba8 --- /dev/null +++ b/esm/lab/UnpackTypeGuard.mjs @@ -0,0 +1,3 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +export {}; +//# sourceMappingURL=UnpackTypeGuard.mjs.map \ No newline at end of file diff --git a/esm/lab/UnpackTypeGuard.mjs.map b/esm/lab/UnpackTypeGuard.mjs.map new file mode 100644 index 0000000..5fbf1bb --- /dev/null +++ b/esm/lab/UnpackTypeGuard.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"UnpackTypeGuard.mjs","sourceRoot":"","sources":["../../src/lab/UnpackTypeGuard.ts"],"names":[],"mappings":"AAAA,uDAAuD"} \ No newline at end of file diff --git a/esm/lab/defineAccessors.d.ts b/esm/lab/defineAccessors.d.ts new file mode 100644 index 0000000..0b07e45 --- /dev/null +++ b/esm/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/esm/lab/defineAccessors.mjs b/esm/lab/defineAccessors.mjs new file mode 100644 index 0000000..229274e --- /dev/null +++ b/esm/lab/defineAccessors.mjs @@ -0,0 +1,31 @@ +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); +}; +export 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); + }, + } + : {}))); +}; +//# sourceMappingURL=defineAccessors.mjs.map \ No newline at end of file diff --git a/esm/lab/defineAccessors.mjs.map b/esm/lab/defineAccessors.mjs.map new file mode 100644 index 0000000..0b27484 --- /dev/null +++ b/esm/lab/defineAccessors.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"defineAccessors.mjs","sourceRoot":"","sources":["../../src/lab/defineAccessors.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,MAAM,CAAC,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"} \ No newline at end of file diff --git a/esm/lab/overwriteReadonlyProp.d.ts b/esm/lab/overwriteReadonlyProp.d.ts new file mode 100644 index 0000000..225c2c2 --- /dev/null +++ b/esm/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/esm/lab/overwriteReadonlyProp.mjs b/esm/lab/overwriteReadonlyProp.mjs new file mode 100644 index 0000000..1b5c2ca --- /dev/null +++ b/esm/lab/overwriteReadonlyProp.mjs @@ -0,0 +1,48 @@ +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); +}; +/* eslint-disable no-empty */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { assert } from "../assert.mjs"; +import { is } from "../is.mjs"; +/** + * 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 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) { + assert(is(error)); + errorDefineProperty = error; + } + if (obj[propertyName] !== value) { + throw errorDefineProperty || new Error("Can't assign"); + } + return value; +}; +//# sourceMappingURL=overwriteReadonlyProp.mjs.map \ No newline at end of file diff --git a/esm/lab/overwriteReadonlyProp.mjs.map b/esm/lab/overwriteReadonlyProp.mjs.map new file mode 100644 index 0000000..0d78e02 --- /dev/null +++ b/esm/lab/overwriteReadonlyProp.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"overwriteReadonlyProp.mjs","sourceRoot":"","sources":["../../src/lab/overwriteReadonlyProp.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,6BAA6B;AAC7B,uDAAuD;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B;;;KAGK;AACL,MAAM,CAAC,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,MAAM,CAAC,EAAE,CAAQ,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"} \ No newline at end of file diff --git a/esm/lab/withDefaults.d.ts b/esm/lab/withDefaults.d.ts new file mode 100644 index 0000000..19a01b0 --- /dev/null +++ b/esm/lab/withDefaults.d.ts @@ -0,0 +1,16 @@ +import "../tools/Object.fromEntries.mjs"; +/** + * 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/esm/lab/withDefaults.mjs b/esm/lab/withDefaults.mjs new file mode 100644 index 0000000..ceb4f88 --- /dev/null +++ b/esm/lab/withDefaults.mjs @@ -0,0 +1,62 @@ +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; +}; +/* eslint-disable @typescript-eslint/ban-ts-comment */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import "../tools/Object.fromEntries.mjs"; +/** + * 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(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]]; + })))); + }; +} +//# sourceMappingURL=withDefaults.mjs.map \ No newline at end of file diff --git a/esm/lab/withDefaults.mjs.map b/esm/lab/withDefaults.mjs.map new file mode 100644 index 0000000..1acadb9 --- /dev/null +++ b/esm/lab/withDefaults.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"withDefaults.mjs","sourceRoot":"","sources":["../../src/lab/withDefaults.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAsD;AACtD,uDAAuD;AACvD,OAAO,6BAA6B,CAAC;AACrC;;;;;GAKG;AACH,MAAM,UAAU,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"} \ No newline at end of file diff --git a/esm/noUndefined.d.ts b/esm/noUndefined.d.ts new file mode 100644 index 0000000..51e3bbc --- /dev/null +++ b/esm/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/esm/noUndefined.mjs b/esm/noUndefined.mjs new file mode 100644 index 0000000..61a73fb --- /dev/null +++ b/esm/noUndefined.mjs @@ -0,0 +1,21 @@ +/* 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) { + var out = {}; + for (var key in obj) { + if (obj[key] === undefined) { + continue; + } + out[key] = obj[key]; + } + return out; +} +//# sourceMappingURL=noUndefined.mjs.map \ No newline at end of file diff --git a/esm/noUndefined.mjs.map b/esm/noUndefined.mjs.map new file mode 100644 index 0000000..554739a --- /dev/null +++ b/esm/noUndefined.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"noUndefined.mjs","sourceRoot":"","sources":["../src/noUndefined.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,iDAAiD;AAEjD;;;;;;;GAOG;AACH,MAAM,UAAU,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"} \ No newline at end of file diff --git a/esm/objectEntries.d.ts b/esm/objectEntries.d.ts new file mode 100644 index 0000000..723eabc --- /dev/null +++ b/esm/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/esm/objectEntries.mjs b/esm/objectEntries.mjs new file mode 100644 index 0000000..6f97995 --- /dev/null +++ b/esm/objectEntries.mjs @@ -0,0 +1,6 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** https://docs.tsafe.dev/objectentries */ +export function objectEntries(o) { + return Object.entries(o); +} +//# sourceMappingURL=objectEntries.mjs.map \ No newline at end of file diff --git a/esm/objectEntries.mjs.map b/esm/objectEntries.mjs.map new file mode 100644 index 0000000..ab79f8d --- /dev/null +++ b/esm/objectEntries.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"objectEntries.mjs","sourceRoot":"","sources":["../src/objectEntries.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,2CAA2C;AAC3C,MAAM,UAAU,aAAa,CACzB,CAAI;IAEJ,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAQ,CAAC;AACpC,CAAC"} \ No newline at end of file diff --git a/esm/objectFromEntries.d.ts b/esm/objectFromEntries.d.ts new file mode 100644 index 0000000..09e62db --- /dev/null +++ b/esm/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/esm/objectFromEntries.mjs b/esm/objectFromEntries.mjs new file mode 100644 index 0000000..38240cc --- /dev/null +++ b/esm/objectFromEntries.mjs @@ -0,0 +1,6 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** https://docs.tsafe.dev/objectFromEntries */ +export function objectFromEntries(entries) { + return Object.fromEntries(entries); +} +//# sourceMappingURL=objectFromEntries.mjs.map \ No newline at end of file diff --git a/esm/objectFromEntries.mjs.map b/esm/objectFromEntries.mjs.map new file mode 100644 index 0000000..f73a79d --- /dev/null +++ b/esm/objectFromEntries.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"objectFromEntries.mjs","sourceRoot":"","sources":["../src/objectFromEntries.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,+CAA+C;AAC/C,MAAM,UAAU,iBAAiB,CAC7B,OAAyB;IAEzB,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAQ,CAAC;AAC9C,CAAC"} \ No newline at end of file diff --git a/esm/objectKeys.d.ts b/esm/objectKeys.d.ts new file mode 100644 index 0000000..103b048 --- /dev/null +++ b/esm/objectKeys.d.ts @@ -0,0 +1,2 @@ +/** https://docs.tsafe.dev/objectKeys */ +export declare function objectKeys>(o: T): (keyof T)[]; diff --git a/esm/objectKeys.mjs b/esm/objectKeys.mjs new file mode 100644 index 0000000..80802fc --- /dev/null +++ b/esm/objectKeys.mjs @@ -0,0 +1,6 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/** https://docs.tsafe.dev/objectKeys */ +export function objectKeys(o) { + return Object.keys(o); +} +//# sourceMappingURL=objectKeys.mjs.map \ No newline at end of file diff --git a/esm/objectKeys.mjs.map b/esm/objectKeys.mjs.map new file mode 100644 index 0000000..32758dc --- /dev/null +++ b/esm/objectKeys.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"objectKeys.mjs","sourceRoot":"","sources":["../src/objectKeys.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,wCAAwC;AACxC,MAAM,UAAU,UAAU,CAAoC,CAAI;IAC9D,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAQ,CAAC;AACjC,CAAC"} \ No newline at end of file diff --git a/esm/symToStr.d.ts b/esm/symToStr.d.ts new file mode 100644 index 0000000..2b817d2 --- /dev/null +++ b/esm/symToStr.d.ts @@ -0,0 +1,2 @@ +/** @see */ +export declare function symToStr>(wrap: T): keyof T; diff --git a/esm/symToStr.mjs b/esm/symToStr.mjs new file mode 100644 index 0000000..21651cc --- /dev/null +++ b/esm/symToStr.mjs @@ -0,0 +1,5 @@ +/** @see */ +export function symToStr(wrap) { + return Object.keys(wrap)[0]; +} +//# sourceMappingURL=symToStr.mjs.map \ No newline at end of file diff --git a/esm/symToStr.mjs.map b/esm/symToStr.mjs.map new file mode 100644 index 0000000..c552741 --- /dev/null +++ b/esm/symToStr.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"symToStr.mjs","sourceRoot":"","sources":["../src/symToStr.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,MAAM,UAAU,QAAQ,CAAoC,IAAO;IAC/D,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC"} \ No newline at end of file diff --git a/esm/tools/Object.fromEntries.d.ts b/esm/tools/Object.fromEntries.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/esm/tools/Object.fromEntries.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/esm/tools/Object.fromEntries.mjs b/esm/tools/Object.fromEntries.mjs new file mode 100644 index 0000000..1bfeef4 --- /dev/null +++ b/esm/tools/Object.fromEntries.mjs @@ -0,0 +1,34 @@ +/* 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; +}; +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; + }, + }); +} +export {}; +//# sourceMappingURL=Object.fromEntries.mjs.map \ No newline at end of file diff --git a/esm/tools/Object.fromEntries.mjs.map b/esm/tools/Object.fromEntries.mjs.map new file mode 100644 index 0000000..1b236e0 --- /dev/null +++ b/esm/tools/Object.fromEntries.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"Object.fromEntries.mjs","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/esm/tools/StrictEquals.d.ts b/esm/tools/StrictEquals.d.ts new file mode 100644 index 0000000..0871a91 --- /dev/null +++ b/esm/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/esm/tools/StrictEquals.mjs b/esm/tools/StrictEquals.mjs new file mode 100644 index 0000000..49c89ba --- /dev/null +++ b/esm/tools/StrictEquals.mjs @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=StrictEquals.mjs.map \ No newline at end of file diff --git a/esm/tools/StrictEquals.mjs.map b/esm/tools/StrictEquals.mjs.map new file mode 100644 index 0000000..b47e939 --- /dev/null +++ b/esm/tools/StrictEquals.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"StrictEquals.mjs","sourceRoot":"","sources":["../../src/tools/StrictEquals.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/esm/tools/Unite.d.ts b/esm/tools/Unite.d.ts new file mode 100644 index 0000000..a75c362 --- /dev/null +++ b/esm/tools/Unite.d.ts @@ -0,0 +1,3 @@ +export type Unite = T extends Record ? { + [Key in keyof T]: T[Key]; +} : T; diff --git a/esm/tools/Unite.mjs b/esm/tools/Unite.mjs new file mode 100644 index 0000000..cdf98a2 --- /dev/null +++ b/esm/tools/Unite.mjs @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=Unite.mjs.map \ No newline at end of file diff --git a/esm/tools/Unite.mjs.map b/esm/tools/Unite.mjs.map new file mode 100644 index 0000000..a98731d --- /dev/null +++ b/esm/tools/Unite.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"Unite.mjs","sourceRoot":"","sources":["../../src/tools/Unite.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/esm/tools/getProjectRoot.d.ts b/esm/tools/getProjectRoot.d.ts new file mode 100644 index 0000000..7927ee7 --- /dev/null +++ b/esm/tools/getProjectRoot.d.ts @@ -0,0 +1 @@ +export declare function getProjectRoot(): string; diff --git a/esm/tools/getProjectRoot.mjs b/esm/tools/getProjectRoot.mjs new file mode 100644 index 0000000..c32dff3 --- /dev/null +++ b/esm/tools/getProjectRoot.mjs @@ -0,0 +1,16 @@ +import * as fs from "fs"; +import * as path from "path"; +function getProjectRootRec(dirPath) { + if (fs.existsSync(path.join(dirPath, "package.json"))) { + return dirPath; + } + return getProjectRootRec(path.join(dirPath, "..")); +} +var result = undefined; +export function getProjectRoot() { + if (result !== undefined) { + return result; + } + return (result = getProjectRootRec(__dirname)); +} +//# sourceMappingURL=getProjectRoot.mjs.map \ No newline at end of file diff --git a/esm/tools/getProjectRoot.mjs.map b/esm/tools/getProjectRoot.mjs.map new file mode 100644 index 0000000..d87c965 --- /dev/null +++ b/esm/tools/getProjectRoot.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"getProjectRoot.mjs","sourceRoot":"","sources":["../../src/tools/getProjectRoot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;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,MAAM,UAAU,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"} \ No newline at end of file diff --git a/esm/tools/toUpperCase.d.ts b/esm/tools/toUpperCase.d.ts new file mode 100644 index 0000000..c2dd61b --- /dev/null +++ b/esm/tools/toUpperCase.d.ts @@ -0,0 +1 @@ +export declare function toUpperCase(str: string): string; diff --git a/esm/tools/toUpperCase.mjs b/esm/tools/toUpperCase.mjs new file mode 100644 index 0000000..eaaa8ad --- /dev/null +++ b/esm/tools/toUpperCase.mjs @@ -0,0 +1,4 @@ +export function toUpperCase(str) { + return str.toUpperCase(); +} +//# sourceMappingURL=toUpperCase.mjs.map \ No newline at end of file diff --git a/esm/tools/toUpperCase.mjs.map b/esm/tools/toUpperCase.mjs.map new file mode 100644 index 0000000..a212b2f --- /dev/null +++ b/esm/tools/toUpperCase.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"toUpperCase.mjs","sourceRoot":"","sources":["../../src/tools/toUpperCase.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAC,GAAW;IACnC,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC;AAC7B,CAAC"} \ No newline at end of file diff --git a/esm/tsconfig.esm.tsbuildinfo b/esm/tsconfig.esm.tsbuildinfo new file mode 100644 index 0000000..1aeea90 --- /dev/null +++ b/esm/tsconfig.esm.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","../../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/tools/getProjectRoot.ts","../../src/tools/toUpperCase.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/worker_threads.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/events.d.ts","../../node_modules/@types/node/dom-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/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":"d5c0ac6a5965e46d089b3dab85a41a68d51f199a095c5a35c1b39fd15d31bc3c","affectsGlobalScope":true},"e8d2e50f9e8fdd312d31f97571b4c7295b8f29f7f8363498edae2a9eb113ee36","4b1854aec637e8e041eff02899e16fd3c0c78685c622336aadfd67e6604bbe1b","d6f7d47355a0167969e9a8eedfb0994f21e038d360965ec06c30f6871038900b","4735756aff7c5857de387f321633f272e2daba4950c427ab200de954340c7c13","13dfb22c1b46f9858b19fc7df54674146f3d174ccd35f0e02e8d05a3026b9ba8","33d21bcca0f7b054d0d0d402125f547c9ac77782c2df301de314143f08e81406",{"version":"b7f90b66a152a20964d4020a56c2e7db4afe37b9ce4609552bf643810f745e8b","affectsGlobalScope":true},{"version":"55cc4ba886da5b6b225abf48d4fa10fa2762d22dc4ed8864cca2621ac70e7e66","affectsGlobalScope":true},{"version":"3523038578cadf637fdce58f06018e144fd5b26c12e3f9c1cef14cdf92ca3d20","affectsGlobalScope":true},{"version":"28065193ddf88bf697915b9236d2d00a27e85726563e88474f166790376e10d8","affectsGlobalScope":true},{"version":"511c964513d7c2f72556554cdeb960b4f0445990d11080297a97cc7b5fa1bb68","affectsGlobalScope":true},{"version":"725daac09ec6eb9086c2bea6bbdf6d6ab2a6f49d686656c6021a4da0415fe31f","affectsGlobalScope":true},{"version":"21574b67bbedcb39a6efa00ca47e5b9402946a4d4e890abd5b51d3fd371819ba","affectsGlobalScope":true},{"version":"2415a2b1a4a521594b9837316ae3950b0c0c2f8b689defd358986bf3e263e904","affectsGlobalScope":true},{"version":"e5d8d715990d96a37f3521a3f1460679507b261eec1b42dc84d4de835997b794","affectsGlobalScope":true},{"version":"93fa2a84417c65ab8ed121a0b84536312e00a11cbf45b0006a75324d00b176d2","affectsGlobalScope":true},{"version":"a003a6051b48dc64eaa8ad83789e4c2a540f3482bed821053b6770969bd598fb","affectsGlobalScope":true},{"version":"e90857fa86cecc3bc964a2d7db9d95a0c406bebfadeb4853a01a0079936f12f7","affectsGlobalScope":true},{"version":"8bbb03589e48f10b49996064f35256e858d205dcb364428fb4cc045061b1d786","affectsGlobalScope":true},{"version":"5044747370afee4b4c247e8a14c2969d245bbcf8396295dc5a60c659d796a71f","affectsGlobalScope":true},{"version":"8e4921934f4bec04df1bee5762a8f4ad9213f0dab33ea10c5bb1ba1201070c6a","affectsGlobalScope":true},{"version":"a894424c7058bcc77c1a3c92fe289c0ff93792e583e064c683d021879479f7b8","affectsGlobalScope":true},{"version":"8f03386d697248c5d356fd53f2729b920ea124cd1414a6c22de03c5d24729277","affectsGlobalScope":true},{"version":"21ac76354ecc1324ee2e31ac5fcebfa91b1b6beb3e8c3fe6f3988538e9629c73","affectsGlobalScope":true},{"version":"0f71e010899461f256a976d1bece8f39710a8661ced0ae3a4a757f61e0b0200d","affectsGlobalScope":true},{"version":"fe7acdc1039eca904399190766d1c8766b7d2621413f972c8542dddd69612097","affectsGlobalScope":true},{"version":"c25aa843b930662d62f0e853dd1f347d08b66cdec09bd760151d4ba6ce220fe6","affectsGlobalScope":true},{"version":"3e47477f297e4fa0d556c40a872c2c45bddefa487fd054bf1f80bceb527a682b","affectsGlobalScope":true},{"version":"a902be9f4116b449dbac07ffe3f4d69abb664f8eddfaeb892225612469213788","affectsGlobalScope":true},{"version":"155d8d1e367e05af5e5708a860825785f00eabae01744cf7bc569664301415a4","affectsGlobalScope":true},{"version":"5b30b81cdeb239772daf44e6c0d5bf6adec9dbf8d534ed25c9a0e8a43b9abfff","affectsGlobalScope":true},{"version":"cdb77abf1220d79a20508bbcfddf21f0437ea8ef5939ba46f999c4987061baab","affectsGlobalScope":true},{"version":"62e02a2f5889850ed658dfde861b2ba84fb22f3663ea3b2e2f7fb3dcd1813431","affectsGlobalScope":true},{"version":"357921f26d612a4c5ac9896340e6a2beffcaf889ff5cdfcc742e9af804d1a448","affectsGlobalScope":true},{"version":"d836a4258d6b5ee12054b802002d7c9c5eb6a1adb6a654f0ee9429cbda03e1a0","affectsGlobalScope":true},{"version":"c021bff90eb33d29edfde16c9b861097bbf99aa290726d0d0ac65330aa7be85a","affectsGlobalScope":true},{"version":"1c4e64dc374ea5922d7632a52b167187ba7c7e35b34d3c1e22625be66ca1576d","affectsGlobalScope":true},{"version":"cd1bebc4db8fb52c5618ecad3f511f62c78921451c198220c5b2ee5610b4d7b9","affectsGlobalScope":true},{"version":"fb60e7c9de1306648f865b4c8ef76b7376731af3955b69551004ad3848fb8f4c","affectsGlobalScope":true},{"version":"18d23591bba5678cf57ef139e1a3daad8017b26ad6612c8c34d6fa39044b245f","affectsGlobalScope":true},{"version":"a0c22cc020e4812220d19113592740068675a7fdebc2622ffdba49acc338178f","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"},{"version":"3e6239b7b45d4c78f745b459e3a8493af4be6a5fc078cbc6c471d5db77902a06","signature":"200426c8d87ae866a7eb0e9ce577ebd7b9437df0f4d166965840e01e96144eff"},{"version":"0f2ac3e73064d6a8ec7f3ef8c726ecc9bd2cc34045cf18b2ec8142790d75bbe7","signature":"55216b3caf3325c8aa65aab47b84e826fca2bb492e229733d5599cc2ba4958fe"},"c401118ea6c6daa9f196013b0622c602d4faec565bb1cc6ca751d2a8fc295498","0359682c54e487c4cab2b53b2b4d35cc8dea4d9914bc6abcdb5701f8b8e745a4","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},{"version":"ca72190df0eb9b09d4b600821c8c7b6c9747b75a1c700c4d57dc0bb72abc074c","affectsGlobalScope":true},"21a167fec8f933752fb8157f06d28fab6817af3ad9b0bdb1908a10762391eab9",{"version":"bb65c6267c5d6676be61acbf6604cf0a4555ac4b505df58ac15c831fcbff4e3e","affectsGlobalScope":true},"374ca798f244e464346f14301dc2a8b4b111af1a83b49fffef5906c338a1f922","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","dab86d9604fe40854ef3c0a6f9e8948873dc3509213418e5e457f410fd11200f","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","489532ff54b714f0e0939947a1c560e516d3ae93d51d639ab02e907a0e950114","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","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","8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"8dbe725f8d237e70310977afcfa011629804d101ebaa0266cafda6b61ad72236","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b"],"options":{"declaration":true,"downlevelIteration":true,"esModuleInterop":true,"jsx":4,"module":5,"newLine":1,"noFallthroughCasesInSwitch":true,"noUnusedLocals":true,"noUnusedParameters":true,"outDir":"./","sourceMap":true,"strict":true,"target":1},"fileIdsList":[[130],[83,130],[87,130],[88,93,121,130],[89,99,101,108,118,129,130],[89,90,99,108,130],[91,130],[92,93,101,109,130],[93,118,126,130],[94,96,99,108,130],[95,130],[96,97,130],[99,130],[98,99,130],[99,101,102,118,129,130],[99,101,102,115,118,121,130],[85,130],[96,103,108,118,129,130],[99,101,103,104,108,118,126,129,130],[103,105,118,126,129,130],[83,84,85,86,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],[99,106,130],[107,129,130],[96,99,108,118,130],[109,130],[110,130],[87,111,130],[85,112,128,130],[113,130],[114,130],[99,115,116,130],[115,117,130,132],[88,99,118,119,120,121,130],[88,118,120,130],[118,119,130],[121,130],[122,130],[99,124,125,130],[124,125,130],[93,108,118,126,130],[127,130],[108,128,130],[88,103,114,129,130],[93,130],[118,130,131],[130,132],[130,133],[85,88,93,99,102,111,118,129,130,132],[118,130,134],[43,44,130],[44,130],[49,130],[51,130],[45,58,60,130],[45,46,47,48,49,50,51,52,53,54,55,56,57,59,61,62,63,64,65,66,67,68,69,70,71,130],[58,130],[59,61,130],[77,130],[101,110,130],[57,130],[43,44],[44],[49],[51],[45],[77]],"referencedMap":[[81,1],[82,1],[83,2],[84,2],[87,3],[88,4],[89,5],[90,6],[91,7],[92,8],[93,9],[94,10],[95,11],[96,12],[97,12],[100,13],[98,14],[99,13],[101,15],[102,16],[86,17],[135,1],[103,18],[104,19],[105,20],[136,21],[106,22],[107,23],[108,24],[109,25],[110,26],[111,27],[112,28],[113,29],[114,30],[115,31],[116,31],[117,32],[118,33],[120,34],[119,35],[121,36],[122,37],[123,1],[124,38],[125,39],[126,40],[127,41],[128,42],[129,43],[130,44],[131,45],[132,46],[133,47],[85,48],[134,49],[137,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],[45,50],[46,51],[47,1],[48,1],[50,52],[49,1],[51,1],[52,53],[53,1],[54,1],[55,1],[56,1],[61,54],[62,1],[63,1],[64,1],[57,1],[72,55],[59,56],[65,1],[74,1],[75,1],[76,1],[60,57],[78,58],[70,1],[68,1],[69,1],[66,1],[73,1],[77,1],[44,1],[43,1],[79,59],[80,1],[67,1],[71,1],[58,60]],"exportedModulesMap":[[81,1],[82,1],[83,2],[84,2],[87,3],[88,4],[89,5],[90,6],[91,7],[92,8],[93,9],[94,10],[95,11],[96,12],[97,12],[100,13],[98,14],[99,13],[101,15],[102,16],[86,17],[135,1],[103,18],[104,19],[105,20],[136,21],[106,22],[107,23],[108,24],[109,25],[110,26],[111,27],[112,28],[113,29],[114,30],[115,31],[116,31],[117,32],[118,33],[120,34],[119,35],[121,36],[122,37],[123,1],[124,38],[125,39],[126,40],[127,41],[128,42],[129,43],[130,44],[131,45],[132,46],[133,47],[85,48],[134,49],[137,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],[45,61],[46,62],[48,1],[50,63],[52,64],[61,65],[72,55],[74,1],[78,66]],"semanticDiagnosticsPerFile":[81,82,83,84,87,88,89,90,91,92,93,94,95,96,97,100,98,99,101,102,86,135,103,104,105,136,106,107,108,109,110,111,112,113,114,115,116,117,118,120,119,121,122,123,124,125,126,127,128,129,130,131,132,133,85,134,137,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,45,46,47,48,50,49,51,52,53,54,55,56,61,62,63,64,57,72,59,65,74,75,76,60,78,70,68,69,66,73,77,44,43,79,80,67,71,58]},"version":"5.0.0-dev.20230109"} \ No newline at end of file diff --git a/esm/typeGuard.d.ts b/esm/typeGuard.d.ts new file mode 100644 index 0000000..e5924e2 --- /dev/null +++ b/esm/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/esm/typeGuard.mjs b/esm/typeGuard.mjs new file mode 100644 index 0000000..15d5a22 --- /dev/null +++ b/esm/typeGuard.mjs @@ -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, isMatched) { + return isMatched; +} +//# sourceMappingURL=typeGuard.mjs.map \ No newline at end of file diff --git a/esm/typeGuard.mjs.map b/esm/typeGuard.mjs.map new file mode 100644 index 0000000..3f7d2f5 --- /dev/null +++ b/esm/typeGuard.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"typeGuard.mjs","sourceRoot":"","sources":["../src/typeGuard.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,uDAAuD;AAEvD,uCAAuC;AACvC,MAAM,UAAU,SAAS,CAAI,MAAW,EAAE,SAAkB;IACxD,OAAO,SAAS,CAAC;AACrB,CAAC"} \ No newline at end of file diff --git a/esm/uncapitalize.d.ts b/esm/uncapitalize.d.ts new file mode 100644 index 0000000..1496b91 --- /dev/null +++ b/esm/uncapitalize.d.ts @@ -0,0 +1,2 @@ +/** @see */ +export declare function uncapitalize(str: S): Uncapitalize; diff --git a/esm/uncapitalize.mjs b/esm/uncapitalize.mjs new file mode 100644 index 0000000..35d83f1 --- /dev/null +++ b/esm/uncapitalize.mjs @@ -0,0 +1,6 @@ +/** @see */ +export function uncapitalize(str) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (str.charAt(0).toLowerCase() + str.slice(1)); +} +//# sourceMappingURL=uncapitalize.mjs.map \ No newline at end of file diff --git a/esm/uncapitalize.mjs.map b/esm/uncapitalize.mjs.map new file mode 100644 index 0000000..d8e06b0 --- /dev/null +++ b/esm/uncapitalize.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"uncapitalize.mjs","sourceRoot":"","sources":["../src/uncapitalize.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,MAAM,UAAU,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"} \ No newline at end of file diff --git a/esm/zz_internal/assertIsRefWrapper.d.ts b/esm/zz_internal/assertIsRefWrapper.d.ts new file mode 100644 index 0000000..443d0e1 --- /dev/null +++ b/esm/zz_internal/assertIsRefWrapper.d.ts @@ -0,0 +1,3 @@ +export declare const assertIsRefWrapper: { + ref: Record | undefined; +}; diff --git a/esm/zz_internal/assertIsRefWrapper.mjs b/esm/zz_internal/assertIsRefWrapper.mjs new file mode 100644 index 0000000..547f45e --- /dev/null +++ b/esm/zz_internal/assertIsRefWrapper.mjs @@ -0,0 +1,5 @@ +import { id } from "../id.mjs"; +export var assertIsRefWrapper = { + "ref": id(undefined), +}; +//# sourceMappingURL=assertIsRefWrapper.mjs.map \ No newline at end of file diff --git a/esm/zz_internal/assertIsRefWrapper.mjs.map b/esm/zz_internal/assertIsRefWrapper.mjs.map new file mode 100644 index 0000000..16974aa --- /dev/null +++ b/esm/zz_internal/assertIsRefWrapper.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"assertIsRefWrapper.mjs","sourceRoot":"","sources":["../../src/zz_internal/assertIsRefWrapper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAE3B,MAAM,CAAC,IAAM,kBAAkB,GAAG;IAC9B,KAAK,EAAE,EAAE,CAAoC,SAAS,CAAC;CAC1D,CAAC"} \ No newline at end of file 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/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 86c30dc..6baf053 100755 --- a/package.json +++ b/package.json @@ -6,20 +6,6 @@ "type": "git", "url": "git://github.com/garronej/tsafe.git" }, - "scripts": { - "build": "yarn build:cjs && yarn build:esm && yarn build:deno", - "build:cjs": "tsc", - "build:esm": "rm -rf dist/esm && tsc -p tsconfig.esm.json && js2mjs dist/esm", - "build:deno": "denoify", - "test": "yarn test:node && yarn test:deno", - "test:deno": "deno run --reload --unstable --no-check deno_dist/test/mod.ts", - "test:node": "node dist/test/", - "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" @@ -36,13 +22,273 @@ "author": "u/garronej", "license": "MIT", "files": [ - "src/", - "!src/test/", - "dist/", - "!dist/test/", - "!dist/tsconfig.tsbuildinfo", - "!dist/esm/test/", - "!dist/esm/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/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/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", + "esm/Equals.d.ts", + "esm/Equals.mjs", + "esm/Equals.mjs.map", + "esm/Extends.d.ts", + "esm/Extends.mjs", + "esm/Extends.mjs.map", + "esm/MethodNames.d.ts", + "esm/MethodNames.mjs", + "esm/MethodNames.mjs.map", + "esm/Not.d.ts", + "esm/Not.mjs", + "esm/Not.mjs.map", + "esm/Param0.d.ts", + "esm/Param0.mjs", + "esm/Param0.mjs.map", + "esm/Parameters.d.ts", + "esm/Parameters.mjs", + "esm/Parameters.mjs.map", + "esm/PickOptionals.d.ts", + "esm/PickOptionals.mjs", + "esm/PickOptionals.mjs.map", + "esm/PickRequired.d.ts", + "esm/PickRequired.mjs", + "esm/PickRequired.mjs.map", + "esm/Reflect.d.ts", + "esm/Reflect.mjs", + "esm/Reflect.mjs.map", + "esm/ReturnType.d.ts", + "esm/ReturnType.mjs", + "esm/ReturnType.mjs.map", + "esm/UnionToIntersection.d.ts", + "esm/UnionToIntersection.mjs", + "esm/UnionToIntersection.mjs.map", + "esm/UnpackPromise.d.ts", + "esm/UnpackPromise.mjs", + "esm/UnpackPromise.mjs.map", + "esm/assert.d.ts", + "esm/assert.mjs", + "esm/assert.mjs.map", + "esm/capitalize.d.ts", + "esm/capitalize.mjs", + "esm/capitalize.mjs.map", + "esm/exclude.d.ts", + "esm/exclude.mjs", + "esm/exclude.mjs.map", + "esm/flip.d.ts", + "esm/flip.mjs", + "esm/flip.mjs.map", + "esm/id.d.ts", + "esm/id.mjs", + "esm/id.mjs.map", + "esm/index.d.ts", + "esm/index.mjs", + "esm/index.mjs.map", + "esm/is.d.ts", + "esm/is.mjs", + "esm/is.mjs.map", + "esm/isPromiseLike.d.ts", + "esm/isPromiseLike.mjs", + "esm/isPromiseLike.mjs.map", + "esm/lab/PromiseOrNot.d.ts", + "esm/lab/PromiseOrNot.mjs", + "esm/lab/PromiseOrNot.mjs.map", + "esm/lab/UnpackTypeGuard.d.ts", + "esm/lab/UnpackTypeGuard.mjs", + "esm/lab/UnpackTypeGuard.mjs.map", + "esm/lab/defineAccessors.d.ts", + "esm/lab/defineAccessors.mjs", + "esm/lab/defineAccessors.mjs.map", + "esm/lab/overwriteReadonlyProp.d.ts", + "esm/lab/overwriteReadonlyProp.mjs", + "esm/lab/overwriteReadonlyProp.mjs.map", + "esm/lab/withDefaults.d.ts", + "esm/lab/withDefaults.mjs", + "esm/lab/withDefaults.mjs.map", + "esm/noUndefined.d.ts", + "esm/noUndefined.mjs", + "esm/noUndefined.mjs.map", + "esm/objectEntries.d.ts", + "esm/objectEntries.mjs", + "esm/objectEntries.mjs.map", + "esm/objectFromEntries.d.ts", + "esm/objectFromEntries.mjs", + "esm/objectFromEntries.mjs.map", + "esm/objectKeys.d.ts", + "esm/objectKeys.mjs", + "esm/objectKeys.mjs.map", + "esm/symToStr.d.ts", + "esm/symToStr.mjs", + "esm/symToStr.mjs.map", + "esm/tools/Object.fromEntries.d.ts", + "esm/tools/Object.fromEntries.mjs", + "esm/tools/Object.fromEntries.mjs.map", + "esm/tools/StrictEquals.d.ts", + "esm/tools/StrictEquals.mjs", + "esm/tools/StrictEquals.mjs.map", + "esm/tools/Unite.d.ts", + "esm/tools/Unite.mjs", + "esm/tools/Unite.mjs.map", + "esm/tools/getProjectRoot.d.ts", + "esm/tools/getProjectRoot.mjs", + "esm/tools/getProjectRoot.mjs.map", + "esm/tools/toUpperCase.d.ts", + "esm/tools/toUpperCase.mjs", + "esm/tools/toUpperCase.mjs.map", + "esm/tsconfig.esm.tsbuildinfo", + "esm/typeGuard.d.ts", + "esm/typeGuard.mjs", + "esm/typeGuard.mjs.map", + "esm/uncapitalize.d.ts", + "esm/uncapitalize.mjs", + "esm/uncapitalize.mjs.map", + "esm/zz_internal/assertIsRefWrapper.d.ts", + "esm/zz_internal/assertIsRefWrapper.mjs", + "esm/zz_internal/assertIsRefWrapper.mjs.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/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/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", @@ -61,19 +307,19 @@ "prettier": "^2.2.1", "typescript": "5.0.0-dev.20230109" }, - "main": "dist/index.js", - "types": "dist/index.d.ts", - "module": "dist/esm/index.mjs", + "main": "index.js", + "types": "index.d.ts", + "module": "esm/index.mjs", "exports": { ".": { - "require": "./dist/index.js", - "import": "./dist/esm/index.mjs", - "types": "./dist/index.d.ts" + "require": "./index.js", + "import": "./esm/index.mjs", + "types": "./index.d.ts" }, "./*": { - "require": "./dist/*.js", - "import": "./dist/esm/*.mjs", - "types": "./dist/*.d.ts" + "require": "./*.js", + "import": "./esm/*.mjs", + "types": "./*.d.ts" } } } 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/test/Equals.d.ts b/test/Equals.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/Equals.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/Equals.js b/test/Equals.js new file mode 100644 index 0000000..ebd45b9 --- /dev/null +++ b/test/Equals.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var assert_1 = require("../assert"); +{ + (0, assert_1.assert)(); +} +{ + //@ts-expect-error: Because of the & + (0, assert_1.assert)(); + (0, assert_1.assert)(); +} +//# sourceMappingURL=Equals.js.map \ No newline at end of file diff --git a/test/Equals.js.map b/test/Equals.js.map new file mode 100644 index 0000000..dfa5921 --- /dev/null +++ b/test/Equals.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Equals.js","sourceRoot":"","sources":["../src/test/Equals.ts"],"names":[],"mappings":";;AACA,oCAAmC;AAgBnC;IAKI,IAAA,eAAM,GAA+B,CAAC;CACzC;AAED;IAYI,oCAAoC;IACpC,IAAA,eAAM,GAAsB,CAAC;IAE7B,IAAA,eAAM,GAAgB,CAAC;CAC1B"} \ No newline at end of file diff --git a/test/Extends.d.ts b/test/Extends.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/Extends.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/Extends.js b/test/Extends.js new file mode 100644 index 0000000..3bf9911 --- /dev/null +++ b/test/Extends.js @@ -0,0 +1,116 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var assert_1 = require("../assert"); +var emptyObj = {}; +function fn() { + return undefined; +} +var A = /** @class */ (function () { + function A() { + this.a = 1; + } + return A; +}()); +{ + // identity + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); +} +{ + // never extends everything + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + // nothing but itself extends never + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + // any extends nothing but itself and unknown + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + // unknown extends nothing but itself and any + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + // everything extends any + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + // everything extends unknown + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); +} +{ + // numbers + (0, assert_1.assert)(); + (0, assert_1.assert)(); +} +{ + // functions + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); +} +{ + // arrays + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); +} +{ + // objects + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); + (0, assert_1.assert)(); +} +//# sourceMappingURL=Extends.js.map \ No newline at end of file diff --git a/test/Extends.js.map b/test/Extends.js.map new file mode 100644 index 0000000..ede0f33 --- /dev/null +++ b/test/Extends.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Extends.js","sourceRoot":"","sources":["../src/test/Extends.ts"],"names":[],"mappings":";;AAGA,oCAAmC;AAEnC,IAAM,QAAQ,GAAG,EAAE,CAAC;AAQpB,SAAS,EAAE;IACP,OAAO,SAAS,CAAC;AACrB,CAAC;AAED;IAAA;QACI,MAAC,GAAG,CAAC,CAAC;IACV,CAAC;IAAD,QAAC;AAAD,CAAC,AAFD,IAEC;AAED;IACI,WAAW;IACX,IAAA,eAAM,GAAmC,CAAC;IAC1C,IAAA,eAAM,GAAuC,CAAC;IAC9C,IAAA,eAAM,GAA2C,CAAC;IAClD,IAAA,eAAM,GAAqC,CAAC;IAC5C,IAAA,eAAM,GAA+C,CAAC;IACtD,IAAA,eAAM,GAAqC,CAAC;IAC5C,IAAA,eAAM,GAA2C,CAAC;IAClD,IAAA,eAAM,GAAyC,CAAC;IAChD,IAAA,eAAM,GAAyC,CAAC;IAChD,IAAA,eAAM,GAAyC,CAAC;IAChD,IAAA,eAAM,GAAuC,CAAC;IAC9C,IAAA,eAAM,GAAiC,CAAC;IACxC,IAAA,eAAM,GAAmC,CAAC;IAC1C,IAAA,eAAM,GAA+B,CAAC;CACzC;AAED;IACI,2BAA2B;IAC3B,IAAA,eAAM,GAAuC,CAAC;IAC9C,IAAA,eAAM,GAAqC,CAAC;IAC5C,IAAA,eAAM,GAAyC,CAAC;IAChD,IAAA,eAAM,GAAmC,CAAC;IAE1C,mCAAmC;IACnC,IAAA,eAAM,GAAuC,CAAC;IAC9C,IAAA,eAAM,GAAsC,CAAC;IAC7C,IAAA,eAAM,GAA0C,CAAC;IACjD,IAAA,eAAM,GAAoC,CAAC;IAE3C,6CAA6C;IAC7C,IAAA,eAAM,GAAmC,CAAC;IAC1C,IAAA,eAAM,GAAsC,CAAC;IAC7C,IAAA,eAAM,GAAuC,CAAC;IAC9C,IAAA,eAAM,GAAkC,CAAC;IAEzC,6CAA6C;IAC7C,IAAA,eAAM,GAA2C,CAAC;IAClD,IAAA,eAAM,GAA0C,CAAC;IACjD,IAAA,eAAM,GAAuC,CAAC;IAC9C,IAAA,eAAM,GAAsC,CAAC;IAE7C,yBAAyB;IACzB,IAAA,eAAM,GAAqC,CAAC;IAC5C,IAAA,eAAM,GAAuC,CAAC;IAC9C,IAAA,eAAM,GAAiC,CAAC;IAExC,6BAA6B;IAC7B,IAAA,eAAM,GAAuC,CAAC;IAC9C,IAAA,eAAM,GAAyC,CAAC;IAChD,IAAA,eAAM,GAAqC,CAAC;CAC/C;AAED;IACI,UAAU;IACV,IAAA,eAAM,GAAoC,CAAC;IAC3C,IAAA,eAAM,GAAqC,CAAC;CAC/C;AAED;IACI,YAAY;IACZ,IAAA,eAAM,GAAwC,CAAC;IAC/C,IAAA,eAAM,GAAyC,CAAC;IAChD,IAAA,eAAM,GAAsD,CAAC;IAC7D,IAAA,eAAM,GAAwC,CAAC;IAE/C,IAAA,eAAM,GAAuC,CAAC;IAC9C,IAAA,eAAM,GAAoC,CAAC;IAC3C,IAAA,eAAM,GAAyC,CAAC;IAChD,IAAA,eAAM,GAAoC,CAAC;IAC3C,IAAA,eAAM,GAAuC,CAAC;IAC9C,IAAA,eAAM,GAAsC,CAAC;IAC7C,IAAA,eAAM,GAAsC,CAAC;IAC7C,IAAA,eAAM,GAAqC,CAAC;IAC5C,IAAA,eAAM,GAAuD,CAAC;IAC9D,IAAA,eAAM,GAAiC,CAAC;CAC3C;AAED;IACI,SAAS;IACT,IAAA,eAAM,GAAuC,CAAC;IAC9C,IAAA,eAAM,GAAiC,CAAC;IACxC,IAAA,eAAM,GAAqC,CAAC;IAC5C,IAAA,eAAM,GAAoC,CAAC;IAC3C,IAAA,eAAM,GAAqC,CAAC;IAC5C,IAAA,eAAM,GAAuC,CAAC;IAC9C,IAAA,eAAM,GAAqC,CAAC;IAE5C,IAAA,eAAM,GAAwC,CAAC;IAC/C,IAAA,eAAM,GAAyC,CAAC;IAChD,IAAA,eAAM,GAAmC,CAAC;IAC1C,IAAA,eAAM,GAAoC,CAAC;IAE3C,IAAA,eAAM,GAAoD,CAAC;IAC3D,IAAA,eAAM,GAAiD,CAAC;IACxD,IAAA,eAAM,GAAoD,CAAC;IAC3D,IAAA,eAAM,GAAqD,CAAC;IAC5D,IAAA,eAAM,GAAkD,CAAC;IACzD,IAAA,eAAM,GAAoD,CAAC;CAC9D;AAED;IACI,UAAU;IACV,IAAA,eAAM,GAAsC,CAAC;IAC7C,IAAA,eAAM,GAAuC,CAAC;IAE9C,IAAA,eAAM,GAAiD,CAAC;IACxD,IAAA,eAAM,GAAkD,CAAC;IAEzD,IAAA,eAAM,GAAqC,CAAC;IAC5C,IAAA,eAAM,GAAsC,CAAC;IAE7C,IAAA,eAAM,GAA8C,CAAC;IACrD,IAAA,eAAM,GAA6C,CAAC;IACpD,IAAA,eAAM,GAAkD,CAAC;IACzD,IAAA,eAAM,GAAmD,CAAC;CAC7D"} \ No newline at end of file diff --git a/test/MethodNames.d.ts b/test/MethodNames.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/MethodNames.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/MethodNames.js b/test/MethodNames.js new file mode 100644 index 0000000..5416fa1 --- /dev/null +++ b/test/MethodNames.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var assert_1 = require("../assert"); +{ + (0, assert_1.assert)(); +} +var Car = /** @class */ (function () { + function Car() { + this.foo = "caca"; + } + return Car; +}()); +{ + (0, assert_1.assert)(); +} +{ + (0, assert_1.assert)(); +} +//# sourceMappingURL=MethodNames.js.map \ No newline at end of file diff --git a/test/MethodNames.js.map b/test/MethodNames.js.map new file mode 100644 index 0000000..a34fa37 --- /dev/null +++ b/test/MethodNames.js.map @@ -0,0 +1 @@ +{"version":3,"file":"MethodNames.js","sourceRoot":"","sources":["../src/test/MethodNames.ts"],"names":[],"mappings":";;AAEA,oCAAmC;AAGnC;IAaI,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IAGI;QACI,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC;IACtB,CAAC;IACL,UAAC;AAAD,CAAC,AAND,IAMC;AAED;IAcI,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IAYI,IAAA,eAAM,GAAyB,CAAC;CACnC"} \ No newline at end of file diff --git a/test/Parameters.d.ts b/test/Parameters.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/Parameters.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/Parameters.js b/test/Parameters.js new file mode 100644 index 0000000..449de0b --- /dev/null +++ b/test/Parameters.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var assert_1 = require("../assert"); +{ + var myFunction = function (arg1, arg2, extraParams) { + return { + arg1: arg1, + arg2: arg2, + extraParams: extraParams, + }; + }; + (0, assert_1.assert)(); +} +{ + (0, assert_1.assert)(); +} +{ +} +{ + (0, assert_1.assert)(); +} +{ + var A = /** @class */ (function () { + function A(a) { + this.a = a; + } + return A; + }()); +} +//# sourceMappingURL=Parameters.js.map \ No newline at end of file diff --git a/test/Parameters.js.map b/test/Parameters.js.map new file mode 100644 index 0000000..b6811fc --- /dev/null +++ b/test/Parameters.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Parameters.js","sourceRoot":"","sources":["../src/test/Parameters.ts"],"names":[],"mappings":";;AAGA,oCAAmC;AAGnC;IACI,IAAM,UAAU,GAAG,UAAC,IAAa,EAAE,IAAY,EAAE,WAAqC;QAClF,OAAO;YACH,IAAI,MAAA;YACJ,IAAI,MAAA;YACJ,WAAW,aAAA;SACd,CAAC;IACN,CAAC,CAAC;IAKF,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IASI,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;CAGC;AAED;IAII,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IACI;QAEI,WAAY,CAAS;YACjB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACf,CAAC;QACL,QAAC;IAAD,CAAC,AALD,IAKC;CAIJ"} \ No newline at end of file diff --git a/test/Params0.d.ts b/test/Params0.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/Params0.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/Params0.js b/test/Params0.js new file mode 100644 index 0000000..309ffe3 --- /dev/null +++ b/test/Params0.js @@ -0,0 +1,48 @@ +"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 }); +var assert_1 = require("../assert"); +//@ts-ignore +function test() { + var f = function (params) { + return params; + }; + (0, assert_1.assert)(); +} +//@ts-ignore +function test() { + var f = function (params, a, b) { + return __assign(__assign({}, params), { a: a, b: b }); + }; + (0, assert_1.assert)(); +} +{ +} +{ + var A = /** @class */ (function () { + function A(foo) { + this.foo = foo; + } + return A; + }()); +} +{ + (0, assert_1.assert)(); +} +{ + (0, assert_1.assert)(); +} +{ + (0, assert_1.assert)(); +} +//# sourceMappingURL=Params0.js.map \ No newline at end of file diff --git a/test/Params0.js.map b/test/Params0.js.map new file mode 100644 index 0000000..7a37be2 --- /dev/null +++ b/test/Params0.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Params0.js","sourceRoot":"","sources":["../src/test/Params0.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAGA,oCAAmC;AAGnC,YAAY;AACZ,SAAS,IAAI;IACT,IAAM,CAAC,GAAG,UAAC,MAA0B;QACjC,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;IASF,IAAA,eAAM,GAAyB,CAAC;AACpC,CAAC;AAED,YAAY;AACZ,SAAS,IAAI;IACT,IAAM,CAAC,GAAG,UAAC,MAA0B,EAAE,CAAU,EAAE,CAAU;QACzD,6BACO,MAAM,KACT,CAAC,GAAA,EACD,CAAC,GAAA,IACH;IACN,CAAC,CAAC;IASF,IAAA,eAAM,GAAyB,CAAC;AACpC,CAAC;AAED;CAGC;AAED;IACI;QAGI,WAAY,GAAW;YACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACnB,CAAC;QACL,QAAC;IAAD,CAAC,AAND,IAMC;CAIJ;AAED;IAII,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IAII,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IAII,IAAA,eAAM,GAAyB,CAAC;CACnC"} \ No newline at end of file diff --git a/test/PickOptionals.d.ts b/test/PickOptionals.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/PickOptionals.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/PickOptionals.js b/test/PickOptionals.js new file mode 100644 index 0000000..6a03249 --- /dev/null +++ b/test/PickOptionals.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var assert_1 = require("../assert"); +{ + (0, assert_1.assert)(); +} +{ + (0, assert_1.assert)(); +} +{ +} +//# sourceMappingURL=PickOptionals.js.map \ No newline at end of file diff --git a/test/PickOptionals.js.map b/test/PickOptionals.js.map new file mode 100644 index 0000000..2a75832 --- /dev/null +++ b/test/PickOptionals.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PickOptionals.js","sourceRoot":"","sources":["../src/test/PickOptionals.ts"],"names":[],"mappings":";;AAGA,oCAAmC;AAGnC;IAcI,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IAWI,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;CAUC"} \ No newline at end of file diff --git a/test/PickRequired.d.ts b/test/PickRequired.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/PickRequired.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/PickRequired.js b/test/PickRequired.js new file mode 100644 index 0000000..b263225 --- /dev/null +++ b/test/PickRequired.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var assert_1 = require("../assert"); +{ + (0, assert_1.assert)(); +} +{ + (0, assert_1.assert)(); +} +{ +} +//# sourceMappingURL=PickRequired.js.map \ No newline at end of file diff --git a/test/PickRequired.js.map b/test/PickRequired.js.map new file mode 100644 index 0000000..544a851 --- /dev/null +++ b/test/PickRequired.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PickRequired.js","sourceRoot":"","sources":["../src/test/PickRequired.ts"],"names":[],"mappings":";;AAGA,oCAAmC;AAGnC;IAeI,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IAYI,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;CAUC"} \ No newline at end of file diff --git a/test/ReturnType.d.ts b/test/ReturnType.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/ReturnType.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/ReturnType.js b/test/ReturnType.js new file mode 100644 index 0000000..fe8a9b1 --- /dev/null +++ b/test/ReturnType.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var assert_1 = require("../assert"); +{ + var getStringAsync = null; + (0, assert_1.assert)(); +} +{ + var getString = function () { + return null; + }; + (0, assert_1.assert)(); +} +{ + var getString = null; + (0, assert_1.assert)(); +} +{ + var getString = null; + (0, assert_1.assert)(); +} +{ +} +{ +} +{ + var getString = null; + (0, assert_1.assert)(); +} +{ + var getString = null; + (0, assert_1.assert)(); +} +//# sourceMappingURL=ReturnType.js.map \ No newline at end of file diff --git a/test/ReturnType.js.map b/test/ReturnType.js.map new file mode 100644 index 0000000..0d72648 --- /dev/null +++ b/test/ReturnType.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ReturnType.js","sourceRoot":"","sources":["../src/test/ReturnType.ts"],"names":[],"mappings":";;AAIA,oCAAmC;AAGnC;IACI,IAAM,cAAc,GAA0B,IAAW,CAAC;IAK1D,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IACI,IAAM,SAAS,GAAG;QACd,OAAO,IAAW,CAAC;IACvB,CAAC,CAAC;IAKF,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IACI,IAAM,SAAS,GAA8B,IAAW,CAAC;IAKzD,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IACI,IAAM,SAAS,GAAuC,IAAW,CAAC;IAKlE,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;CAGC;AAED;CAGC;AAED;IACI,IAAM,SAAS,GAA4C,IAAW,CAAC;IAKvE,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IACI,IAAM,SAAS,GAAuC,IAAW,CAAC;IAKlE,IAAA,eAAM,GAAyB,CAAC;CACnC"} \ No newline at end of file diff --git a/test/UnionToIntersection.types.d.ts b/test/UnionToIntersection.types.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/UnionToIntersection.types.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/UnionToIntersection.types.js b/test/UnionToIntersection.types.js new file mode 100644 index 0000000..dd93808 --- /dev/null +++ b/test/UnionToIntersection.types.js @@ -0,0 +1,16 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var assert_1 = require("../assert"); +{ + (0, assert_1.assert)(); +} +{ + var o1 = { + "p1": { "a": "foo" }, + "p2": { "b": "foo", "c": "foo" }, + }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + var o2 = {}; + (0, assert_1.assert)(); +} +//# sourceMappingURL=UnionToIntersection.types.js.map \ No newline at end of file diff --git a/test/UnionToIntersection.types.js.map b/test/UnionToIntersection.types.js.map new file mode 100644 index 0000000..7ea7b3f --- /dev/null +++ b/test/UnionToIntersection.types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"UnionToIntersection.types.js","sourceRoot":"","sources":["../src/test/UnionToIntersection.types.ts"],"names":[],"mappings":";;AAEA,oCAAmC;AAEnC;IAOI,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IACI,IAAM,EAAE,GAAG;QACP,IAAI,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE;QACpB,IAAI,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE;KACnC,CAAC;IAEF,8DAA8D;IAC9D,IAAM,EAAE,GAAoD,EAAS,CAAC;IAItE,IAAA,eAAM,GAA+B,CAAC;CACzC"} \ No newline at end of file diff --git a/test/UnpackPromise.d.ts b/test/UnpackPromise.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/UnpackPromise.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/UnpackPromise.js b/test/UnpackPromise.js new file mode 100644 index 0000000..4b17535 --- /dev/null +++ b/test/UnpackPromise.js @@ -0,0 +1,63 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var assert_1 = require("../assert"); +//@ts-ignore +function test() { + var prT = new Promise(function (resolve) { return setTimeout(resolve, 1); }); + (0, assert_1.assert)(); +} +//@ts-ignore +function test() { + var _this = this; + var f = function () { return __awaiter(_this, void 0, void 0, function () { + var out; + return __generator(this, function (_a) { + out = null; + return [2 /*return*/, out]; + }); + }); }; + var prT = f(); + (0, assert_1.assert)(); +} +{ + (0, assert_1.assert)(); +} +{ +} +//# sourceMappingURL=UnpackPromise.js.map \ No newline at end of file diff --git a/test/UnpackPromise.js.map b/test/UnpackPromise.js.map new file mode 100644 index 0000000..c4649c9 --- /dev/null +++ b/test/UnpackPromise.js.map @@ -0,0 +1 @@ +{"version":3,"file":"UnpackPromise.js","sourceRoot":"","sources":["../src/test/UnpackPromise.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,oCAAmC;AAGnC,YAAY;AACZ,SAAS,IAAI;IACT,IAAM,GAAG,GAAG,IAAI,OAAO,CAAI,UAAA,OAAO,IAAI,OAAA,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,EAAtB,CAAsB,CAAC,CAAC;IAK9D,IAAA,eAAM,GAAyB,CAAC;AACpC,CAAC;AAED,YAAY;AACZ,SAAS,IAAI;IAAb,iBAYC;IAXG,IAAM,CAAC,GAAG;;;YACA,GAAG,GAAM,IAAW,CAAC;YAC3B,sBAAO,GAAG,EAAC;;SACd,CAAC;IAEF,IAAM,GAAG,GAAG,CAAC,EAAE,CAAC;IAKhB,IAAA,eAAM,GAAyB,CAAC;AACpC,CAAC;AAED;IAII,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;CAGC"} \ No newline at end of file diff --git a/test/UnpackTypeGuard.d.ts b/test/UnpackTypeGuard.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/UnpackTypeGuard.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/UnpackTypeGuard.js b/test/UnpackTypeGuard.js new file mode 100644 index 0000000..414074b --- /dev/null +++ b/test/UnpackTypeGuard.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var assert_1 = require("../assert"); +{ + var isFoo = function (_o) { + return null; + }; + (0, assert_1.assert)(); +} +//# sourceMappingURL=UnpackTypeGuard.js.map \ No newline at end of file diff --git a/test/UnpackTypeGuard.js.map b/test/UnpackTypeGuard.js.map new file mode 100644 index 0000000..8a26420 --- /dev/null +++ b/test/UnpackTypeGuard.js.map @@ -0,0 +1 @@ +{"version":3,"file":"UnpackTypeGuard.js","sourceRoot":"","sources":["../src/test/UnpackTypeGuard.ts"],"names":[],"mappings":";;AAEA,oCAAmC;AAGnC;IACI,IAAM,KAAK,GAAG,UAAC,EAAO;QAClB,OAAO,IAAW,CAAC;IACvB,CAAC,CAAC;IAKF,IAAA,eAAM,GAAyB,CAAC;CACnC"} \ No newline at end of file diff --git a/test/assertIs.d.ts b/test/assertIs.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/assertIs.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/assertIs.js b/test/assertIs.js new file mode 100644 index 0000000..924ccba --- /dev/null +++ b/test/assertIs.js @@ -0,0 +1,38 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +var assert_1 = require("../assert"); +var is_1 = require("../is"); +{ + var x = null; + (0, assert_1.assert)((0, is_1.is)(x)); + (0, assert_1.assert)(); + console.log("PASS"); +} +{ + var x = null; + (0, assert_1.assert)(!(0, is_1.is)(x)); + (0, assert_1.assert)(); + console.log("PASS"); +} +{ + (0, is_1.is)(null); + try { + (0, is_1.is)(null); + throw new Error("FAIL"); + // eslint-disable-next-line no-empty + } + catch (_a) { } + console.log("PASS"); +} +scope: { + try { + (0, assert_1.assert)(undefined); + } + catch (_b) { + console.log("PASS"); + break scope; + } + throw new Error("Fail"); +} +//# sourceMappingURL=assertIs.js.map \ No newline at end of file diff --git a/test/assertIs.js.map b/test/assertIs.js.map new file mode 100644 index 0000000..504b1e2 --- /dev/null +++ b/test/assertIs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"assertIs.js","sourceRoot":"","sources":["../src/test/assertIs.ts"],"names":[],"mappings":";AAAA,uDAAuD;;AAEvD,oCAAmC;AACnC,4BAA2B;AAG3B;IACI,IAAM,CAAC,GAA8B,IAAW,CAAC;IAEjD,IAAA,eAAM,EAAC,IAAA,OAAE,EAAS,CAAC,CAAC,CAAC,CAAC;IAEtB,IAAA,eAAM,GAA4B,CAAC;IAEnC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AAED;IACI,IAAM,CAAC,GAA8B,IAAW,CAAC;IAEjD,IAAA,eAAM,EAAC,CAAC,IAAA,OAAE,EAAS,CAAC,CAAC,CAAC,CAAC;IAEvB,IAAA,eAAM,GAAsC,CAAC;IAE7C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AAED;IACI,IAAA,OAAE,EAAU,IAAI,CAAC,CAAC;IAElB,IAAI;QACA,IAAA,OAAE,EAAU,IAAI,CAAC,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;QACxB,oCAAoC;KACvC;IAAC,WAAM,GAAE;IAEV,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;CACvB;AAED,KAAK,EAAE;IACH,IAAI;QACA,IAAA,eAAM,EAAC,SAAS,CAAC,CAAC;KACrB;IAAC,WAAM;QACJ,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAEpB,MAAM,KAAK,CAAC;KACf;IAED,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;CAC3B"} \ No newline at end of file diff --git a/test/exclude.d.ts b/test/exclude.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/exclude.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/exclude.js b/test/exclude.js new file mode 100644 index 0000000..b510d17 --- /dev/null +++ b/test/exclude.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var exclude_1 = require("../exclude"); +var assert_1 = require("../assert"); +var same_1 = require("evt/tools/inDepth/same"); +{ + var got = ["a", "b", "c"].filter((0, exclude_1.exclude)("a")); + var expected = ["b", "c"]; + (0, assert_1.assert)((0, same_1.same)(got, expected)); + console.log("PASS TEST 1"); +} +{ + var got = ["a", "b", "c"].filter((0, exclude_1.exclude)(["a"])); + var expected = ["b", "c"]; + (0, assert_1.assert)((0, same_1.same)(got, expected)); + console.log("PASS TEST 2"); +} +{ + var got = [1, 2, 3].filter((0, exclude_1.exclude)("foo")); + var expected = [1, 2, 3]; + (0, assert_1.assert)((0, same_1.same)(got, expected)); + console.log("PASS TEST 3"); +} +{ + var got = ["a", "b", "c", "d"].filter((0, exclude_1.exclude)(["a", "b"])); + var expected = ["c", "d"]; + (0, assert_1.assert)((0, same_1.same)(got, expected)); + console.log("PASS TEST 4"); +} +//# sourceMappingURL=exclude.js.map \ No newline at end of file diff --git a/test/exclude.js.map b/test/exclude.js.map new file mode 100644 index 0000000..af9b29b --- /dev/null +++ b/test/exclude.js.map @@ -0,0 +1 @@ +{"version":3,"file":"exclude.js","sourceRoot":"","sources":["../src/test/exclude.ts"],"names":[],"mappings":";;AAAA,sCAAqC;AACrC,oCAAmC;AACnC,+CAA8C;AAE9C;IACI,IAAM,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAA,iBAAO,EAAC,GAAG,CAAC,CAAC,CAAC;IAEjD,IAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAE5B,IAAA,eAAM,EAAC,IAAA,WAAI,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI,IAAM,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAA,iBAAO,EAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAEnD,IAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAE5B,IAAA,eAAM,EAAC,IAAA,WAAI,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI,IAAM,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,IAAA,iBAAO,EAAC,KAAK,CAAC,CAAC,CAAC;IAE7C,IAAM,QAAQ,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAE3B,IAAA,eAAM,EAAC,IAAA,WAAI,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI,IAAM,GAAG,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAA,iBAAO,EAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAE7D,IAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAE5B,IAAA,eAAM,EAAC,IAAA,WAAI,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B"} \ No newline at end of file diff --git a/test/exclude.types.d.ts b/test/exclude.types.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/exclude.types.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/exclude.types.js b/test/exclude.types.js new file mode 100644 index 0000000..7a3a900 --- /dev/null +++ b/test/exclude.types.js @@ -0,0 +1,23 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +var exclude_1 = require("../exclude"); +var assert_1 = require("../assert"); +{ + var x = ["a", "b", "c"].filter((0, exclude_1.exclude)(["a"])); + (0, assert_1.assert)(); +} +{ + var x = ["a", "b", "c", "d"].filter((0, exclude_1.exclude)(["a", "b"])); + (0, assert_1.assert)(); +} +{ + var x = [3, "a", false].filter((0, exclude_1.exclude)([3])); + (0, assert_1.assert)(); +} +{ + //@ts-expect-error + var x = ["a", "b", "c", "d"].filter((0, exclude_1.exclude)("a", "b")); +} +//# sourceMappingURL=exclude.types.js.map \ No newline at end of file diff --git a/test/exclude.types.js.map b/test/exclude.types.js.map new file mode 100644 index 0000000..43ee170 --- /dev/null +++ b/test/exclude.types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"exclude.types.js","sourceRoot":"","sources":["../src/test/exclude.types.ts"],"names":[],"mappings":";;AAAA,sDAAsD;AACtD,sDAAsD;AACtD,sCAAqC;AACrC,oCAAmC;AAGnC;IACI,IAAM,CAAC,GAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAW,CAAC,MAAM,CAAC,IAAA,iBAAO,EAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAK5D,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IACI,IAAM,CAAC,GAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAW,CAAC,MAAM,CAAC,IAAA,iBAAO,EAAC,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAKtE,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IACI,IAAM,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC,MAAM,CAAC,IAAA,iBAAO,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAM/C,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IACI,kBAAkB;IAClB,IAAM,CAAC,GAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAW,CAAC,MAAM,CAAC,IAAA,iBAAO,EAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;CACvE"} \ No newline at end of file diff --git a/test/flip.d.ts b/test/flip.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/flip.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/flip.js b/test/flip.js new file mode 100644 index 0000000..9068442 --- /dev/null +++ b/test/flip.js @@ -0,0 +1,86 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/* eslint-disable @typescript-eslint/no-explicit-any */ +var flip_1 = require("../flip"); +var assert_1 = require("../assert"); +{ + var obj = { + "is_": true, + "a": 1, + }; + var expected = false; + (0, flip_1.flip)(obj, "is_"); + var got = obj.is_; + (0, assert_1.assert)(got === expected); + console.log("PASS TEST 1"); +} +{ + var obj = { + "is_": true, + }; + var expected = false; + var got = (0, flip_1.flip)(obj, "is_"); + (0, assert_1.assert)(got === expected); + console.log("PASS TEST 2"); +} +{ + var obj = { + "a": { + "is_": true, + "aa": 1, + }, + }; + var expected = false; + (0, flip_1.flip)(obj.a, "is_"); + var got = obj.a.is_; + (0, assert_1.assert)(got === expected); + console.log("PASS TEST 3"); +} +{ + var obj = { + "a": 1, + "is_": true, + }; + var expected = false; + (0, flip_1.flip)(obj, "is_"); + var got = obj.is_; + (0, assert_1.assert)(got === expected); + console.log("PASS TEST 4"); +} +{ + var A = /** @class */ (function () { + function A(is_, a) { + this.is_ = is_; + this.a = a; + } + return A; + }()); + var obj = new A(true, 1); + var expected = false; + (0, flip_1.flip)(obj, "is_"); + var got = obj.is_; + (0, assert_1.assert)(got === expected); + console.log("PASS TEST 5"); +} +{ + var obj = { + "a": 1, + "is_": true, + }; + var expected = false; + (0, flip_1.flip)(obj, "is_"); + var got = obj.is_; + (0, assert_1.assert)(got === expected); + console.log("PASS TEST 6"); +} +{ + var obj = { + "a": 1, + }; + var expected = undefined; + (0, flip_1.flip)(obj, "is_"); + var got = obj.is_; + (0, assert_1.assert)(got === expected); + console.log("PASS TEST 7"); +} +//# sourceMappingURL=flip.js.map \ No newline at end of file diff --git a/test/flip.js.map b/test/flip.js.map new file mode 100644 index 0000000..6f5e4e0 --- /dev/null +++ b/test/flip.js.map @@ -0,0 +1 @@ +{"version":3,"file":"flip.js","sourceRoot":"","sources":["../src/test/flip.ts"],"names":[],"mappings":";;AAAA,uDAAuD;AACvD,gCAA+B;AAC/B,oCAAmC;AAEnC;IACI,IAAM,GAAG,GAAG;QACR,KAAK,EAAE,IAAI;QACX,GAAG,EAAE,CAAC;KACT,CAAC;IAEF,IAAM,QAAQ,GAAG,KAAK,CAAC;IAEvB,IAAA,WAAI,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAEjB,IAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC;IAEpB,IAAA,eAAM,EAAC,GAAG,KAAK,QAAQ,CAAC,CAAC;IAEzB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI,IAAM,GAAG,GAAG;QACR,KAAK,EAAE,IAAI;KACd,CAAC;IAEF,IAAM,QAAQ,GAAG,KAAK,CAAC;IAEvB,IAAM,GAAG,GAAG,IAAA,WAAI,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAE7B,IAAA,eAAM,EAAC,GAAG,KAAK,QAAQ,CAAC,CAAC;IAEzB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI,IAAM,GAAG,GAAG;QACR,GAAG,EAAE;YACD,KAAK,EAAE,IAAI;YACX,IAAI,EAAE,CAAC;SACV;KACJ,CAAC;IAEF,IAAM,QAAQ,GAAG,KAAK,CAAC;IAEvB,IAAA,WAAI,EAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAEnB,IAAM,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAEtB,IAAA,eAAM,EAAC,GAAG,KAAK,QAAQ,CAAC,CAAC;IAEzB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IAMI,IAAM,GAAG,GAAM;QACX,GAAG,EAAE,CAAC;QACN,KAAK,EAAE,IAAI;KACd,CAAC;IAEF,IAAM,QAAQ,GAAG,KAAK,CAAC;IAEvB,IAAA,WAAI,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAEjB,IAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC;IAEpB,IAAA,eAAM,EAAC,GAAG,KAAK,QAAQ,CAAC,CAAC;IAEzB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI;QAII,WAAY,GAAY,EAAE,CAAS;YAC/B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;YACf,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACf,CAAC;QACL,QAAC;IAAD,CAAC,AARD,IAQC;IAED,IAAM,GAAG,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;IAE3B,IAAM,QAAQ,GAAG,KAAK,CAAC;IAEvB,IAAA,WAAI,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAEjB,IAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC;IAEpB,IAAA,eAAM,EAAC,GAAG,KAAK,QAAQ,CAAC,CAAC;IAEzB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IAMI,IAAM,GAAG,GAAM;QACX,GAAG,EAAE,CAAC;QACN,KAAK,EAAE,IAAI;KACd,CAAC;IAEF,IAAM,QAAQ,GAAG,KAAK,CAAC;IAEvB,IAAA,WAAI,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAEjB,IAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC;IAEpB,IAAA,eAAM,EAAC,GAAG,KAAK,QAAQ,CAAC,CAAC;IAEzB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IAMI,IAAM,GAAG,GAAM;QACX,GAAG,EAAE,CAAC;KACT,CAAC;IAEF,IAAM,QAAQ,GAAG,SAAS,CAAC;IAE3B,IAAA,WAAI,EAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAEjB,IAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC;IAEpB,IAAA,eAAM,EAAC,GAAG,KAAK,QAAQ,CAAC,CAAC;IAEzB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B"} \ No newline at end of file diff --git a/test/flip.type.d.ts b/test/flip.type.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/flip.type.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/flip.type.js b/test/flip.type.js new file mode 100644 index 0000000..2b46964 --- /dev/null +++ b/test/flip.type.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/* eslint-disable @typescript-eslint/ban-ts-comment */ +var flip_1 = require("../flip"); +{ + var obj = { + "is_": true, + "a": 1, + }; + //@ts-expect-error + (0, flip_1.flip)(obj, "a"); +} +{ + var obj = { + "is_": true, + }; + //@ts-expect-error + (0, flip_1.flip)(obj, "a"); +} +//# sourceMappingURL=flip.type.js.map \ No newline at end of file diff --git a/test/flip.type.js.map b/test/flip.type.js.map new file mode 100644 index 0000000..827d8d8 --- /dev/null +++ b/test/flip.type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"flip.type.js","sourceRoot":"","sources":["../src/test/flip.type.ts"],"names":[],"mappings":";;AAAA,sDAAsD;AACtD,gCAA+B;AAE/B;IACI,IAAM,GAAG,GAAG;QACR,KAAK,EAAE,IAAI;QACX,GAAG,EAAE,CAAC;KACT,CAAC;IAEF,kBAAkB;IAClB,IAAA,WAAI,EAAC,GAAG,EAAE,GAAG,CAAC,CAAC;CAClB;AAED;IAMI,IAAM,GAAG,GAAM;QACX,KAAK,EAAE,IAAI;KACd,CAAC;IAEF,kBAAkB;IAClB,IAAA,WAAI,EAAC,GAAG,EAAE,GAAG,CAAC,CAAC;CAClB"} \ No newline at end of file diff --git a/test/getProjectRoot.d.ts b/test/getProjectRoot.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/getProjectRoot.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/getProjectRoot.js b/test/getProjectRoot.js new file mode 100644 index 0000000..b2d4a9f --- /dev/null +++ b/test/getProjectRoot.js @@ -0,0 +1,5 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var getProjectRoot_1 = require("../tools/getProjectRoot"); +console.log("Project root path: ".concat((0, getProjectRoot_1.getProjectRoot)(), " does it seems right ? If yes then PASS")); +//# sourceMappingURL=getProjectRoot.js.map \ No newline at end of file diff --git a/test/getProjectRoot.js.map b/test/getProjectRoot.js.map new file mode 100644 index 0000000..ed46502 --- /dev/null +++ b/test/getProjectRoot.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getProjectRoot.js","sourceRoot":"","sources":["../src/test/getProjectRoot.ts"],"names":[],"mappings":";;AAAA,0DAAyD;AAEzD,OAAO,CAAC,GAAG,CAAC,6BAAsB,IAAA,+BAAc,GAAE,4CAAyC,CAAC,CAAC"} \ No newline at end of file diff --git a/test/id.d.ts b/test/id.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/id.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/id.js b/test/id.js new file mode 100644 index 0000000..399f8af --- /dev/null +++ b/test/id.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +var id_1 = require("../id"); +{ + (0, id_1.id)({ "type": "SQUARE", "side": 12 }); + //@ts-expect-error + (0, id_1.id)({ "type": "SQUARE", "side": 12 }); +} +//# sourceMappingURL=id.js.map \ No newline at end of file diff --git a/test/id.js.map b/test/id.js.map new file mode 100644 index 0000000..a0262e5 --- /dev/null +++ b/test/id.js.map @@ -0,0 +1 @@ +{"version":3,"file":"id.js","sourceRoot":"","sources":["../src/test/id.ts"],"names":[],"mappings":";;AAAA,uDAAuD;AACvD,sDAAsD;AACtD,4BAA2B;AAE3B;IAWI,IAAA,OAAE,EAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;IAE7C,kBAAkB;IAClB,IAAA,OAAE,EAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC;CAChD"} \ No newline at end of file diff --git a/test/index.d.ts b/test/index.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/index.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/index.js b/test/index.js new file mode 100644 index 0000000..6466cac --- /dev/null +++ b/test/index.js @@ -0,0 +1,146 @@ +"use strict"; +//This will not run on deno, we need a separate test runner for Deno (./mod.ts). +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; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +var __values = (this && this.__values) || function(o) { + var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; + if (m) return m.call(o); + if (o && typeof o.length === "number") return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; + throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +var child_process = __importStar(require("child_process")); +var path = __importStar(require("path")); +var Deferred_1 = require("evt/tools/Deferred"); +var names = ["withDefault", "flip", "objectKeys", "isPromiseLike", "assertIs", "exclude"]; +(function () { return __awaiter(void 0, void 0, void 0, function () { + var _loop_1, names_1, names_1_1, name_1, e_1_1; + var e_1, _a; + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + if (!!process.env.FORK) { + process.once("unhandledRejection", function (error) { + throw error; + }); + require(process.env.FORK); + return [2 /*return*/]; + } + _loop_1 = function (name_1) { + var dExitCode, exitCode; + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + console.log("Running: ".concat(name_1)); + dExitCode = new Deferred_1.Deferred(); + child_process + .fork(__filename, undefined, { + "env": { "FORK": path.join(__dirname, name_1) }, + }) + .on("message", console.log) + .once("exit", function (code) { return dExitCode.resolve(code !== null && code !== void 0 ? code : 1); }); + return [4 /*yield*/, dExitCode.pr]; + case 1: + exitCode = _c.sent(); + if (exitCode !== 0) { + console.log("".concat(name_1, " exited with error code: ").concat(exitCode)); + process.exit(exitCode); + } + console.log("\n"); + return [2 /*return*/]; + } + }); + }; + _b.label = 1; + case 1: + _b.trys.push([1, 6, 7, 8]); + names_1 = __values(names), names_1_1 = names_1.next(); + _b.label = 2; + case 2: + if (!!names_1_1.done) return [3 /*break*/, 5]; + name_1 = names_1_1.value; + return [5 /*yield**/, _loop_1(name_1)]; + case 3: + _b.sent(); + _b.label = 4; + case 4: + names_1_1 = names_1.next(); + return [3 /*break*/, 2]; + case 5: return [3 /*break*/, 8]; + case 6: + e_1_1 = _b.sent(); + e_1 = { error: e_1_1 }; + return [3 /*break*/, 8]; + case 7: + try { + if (names_1_1 && !names_1_1.done && (_a = names_1.return)) _a.call(names_1); + } + finally { if (e_1) throw e_1.error; } + return [7 /*endfinally*/]; + case 8: return [2 /*return*/]; + } + }); +}); })(); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/test/index.js.map b/test/index.js.map new file mode 100644 index 0000000..b88f0f8 --- /dev/null +++ b/test/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/test/index.ts"],"names":[],"mappings":";AAAA,gFAAgF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhF,2DAA+C;AAC/C,yCAA6B;AAC7B,+CAA8C;AAE9C,IAAM,KAAK,GAAG,CAAC,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AAE5F,CAAC;;;;;;gBACG,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE;oBACpB,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,UAAA,KAAK;wBACpC,MAAM,KAAK,CAAC;oBAChB,CAAC,CAAC,CAAC;oBAEH,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;oBAE1B,sBAAO;iBACV;oCAEU,MAAI;;;;;gCACX,OAAO,CAAC,GAAG,CAAC,mBAAY,MAAI,CAAE,CAAC,CAAC;gCAE1B,SAAS,GAAG,IAAI,mBAAQ,EAAU,CAAC;gCAEzC,aAAa;qCACR,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE;oCACzB,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,MAAI,CAAC,EAAE;iCAChD,CAAC;qCACD,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,GAAG,CAAC;qCAC1B,IAAI,CAAC,MAAM,EAAE,UAAA,IAAI,IAAI,OAAA,SAAS,CAAC,OAAO,CAAC,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,CAAC,CAAC,EAA5B,CAA4B,CAAC,CAAC;gCAEvC,qBAAM,SAAS,CAAC,EAAE,EAAA;;gCAA7B,QAAQ,GAAG,SAAkB;gCAEnC,IAAI,QAAQ,KAAK,CAAC,EAAE;oCAChB,OAAO,CAAC,GAAG,CAAC,UAAG,MAAI,sCAA4B,QAAQ,CAAE,CAAC,CAAC;oCAC3D,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;iCAC1B;gCAED,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;;;;;;;;gBAnBH,UAAA,SAAA,KAAK,CAAA;;;;gBAAnB;8CAAM,MAAI;;;;;;;;;;;;;;;;;;;;;KAqBlB,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/test/isPromiseLike.d.ts b/test/isPromiseLike.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/isPromiseLike.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/isPromiseLike.js b/test/isPromiseLike.js new file mode 100644 index 0000000..e945dba --- /dev/null +++ b/test/isPromiseLike.js @@ -0,0 +1,106 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __generator = (this && this.__generator) || function (thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (g && (g = 0, op[0] && (_ = 0)), _) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +}; +Object.defineProperty(exports, "__esModule", { value: true }); +/* eslint-disable @typescript-eslint/no-explicit-any */ +var isPromiseLike_1 = require("../isPromiseLike"); +var assert_1 = require("../assert"); +{ + var x = new Promise(function (resolve) { return setTimeout(function () { return resolve; }, 1000); }); + var got = (0, isPromiseLike_1.isPromiseLike)(x); + (0, assert_1.assert)(got === true); + console.log("PASS TEST 1"); +} +{ + var x = { + "then": function () { return null; }, + "a": 1, + "b": "foo", + "c": null, + }; + (0, assert_1.assert)((0, isPromiseLike_1.isPromiseLike)(x)); + console.log("PASS TEST 2"); +} +{ + var x = function () { return __awaiter(void 0, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, 1]; + }); + }); }; + (0, assert_1.assert)((0, isPromiseLike_1.isPromiseLike)(x())); + console.log("PASS TEST 3"); +} +{ + var x = function () { return __awaiter(void 0, void 0, void 0, function () { + return __generator(this, function (_a) { + return [2 /*return*/, 1]; + }); + }); }; + (0, assert_1.assert)(!(0, isPromiseLike_1.isPromiseLike)(x)); + console.log("PASS TESt 4"); +} +{ + var x = { + "then": function () { return null; }, + }; + (0, assert_1.assert)((0, isPromiseLike_1.isPromiseLike)(x)); + console.log("PASS TEST 5"); +} +{ + var x = false; + (0, assert_1.assert)(!(0, isPromiseLike_1.isPromiseLike)(x)); + console.log("PASS TEST 6"); +} +{ + var X = /** @class */ (function () { + function X(then) { + this.then = then; + } + return X; + }()); + var x = new X(function () { return null; }); + (0, assert_1.assert)((0, isPromiseLike_1.isPromiseLike)(x)); + console.log("PASS TEST 7"); +} +{ + var x = { + "then": function () { return null; }, + }; + (0, assert_1.assert)((0, isPromiseLike_1.isPromiseLike)(x)); + console.log("PASS TEST 8"); +} +//# sourceMappingURL=isPromiseLike.js.map \ No newline at end of file diff --git a/test/isPromiseLike.js.map b/test/isPromiseLike.js.map new file mode 100644 index 0000000..5dae8ff --- /dev/null +++ b/test/isPromiseLike.js.map @@ -0,0 +1 @@ +{"version":3,"file":"isPromiseLike.js","sourceRoot":"","sources":["../src/test/isPromiseLike.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAuD;AACvD,kDAAiD;AACjD,oCAAmC;AAEnC;IACI,IAAM,CAAC,GAAG,IAAI,OAAO,CAAO,UAAA,OAAO,IAAI,OAAA,UAAU,CAAC,cAAM,OAAA,OAAO,EAAP,CAAO,EAAE,IAAI,CAAC,EAA/B,CAA+B,CAAC,CAAC;IAExE,IAAM,GAAG,GAAG,IAAA,6BAAa,EAAC,CAAC,CAAC,CAAC;IAE7B,IAAA,eAAM,EAAC,GAAG,KAAK,IAAI,CAAC,CAAC;IAErB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI,IAAM,CAAC,GAAG;QACN,MAAM,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI;QAClB,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,IAAI;KACZ,CAAC;IAEF,IAAA,eAAM,EAAC,IAAA,6BAAa,EAAC,CAAC,CAAC,CAAC,CAAC;IAEzB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI,IAAM,CAAC,GAAG;;YACN,sBAAO,CAAC,EAAC;;SACZ,CAAC;IAEF,IAAA,eAAM,EAAC,IAAA,6BAAa,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAE3B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI,IAAM,CAAC,GAAG;;YACN,sBAAO,CAAC,EAAC;;SACZ,CAAC;IAEF,IAAA,eAAM,EAAC,CAAC,IAAA,6BAAa,EAAC,CAAC,CAAC,CAAC,CAAC;IAE1B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI,IAAM,CAAC,GAAwB;QAC3B,MAAM,EAAE,cAAM,OAAA,IAAW,EAAX,CAAW;KAC5B,CAAC;IAEF,IAAA,eAAM,EAAC,IAAA,6BAAa,EAAC,CAAC,CAAC,CAAC,CAAC;IAEzB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI,IAAM,CAAC,GAAG,KAAK,CAAC;IAEhB,IAAA,eAAM,EAAC,CAAC,IAAA,6BAAa,EAAC,CAAC,CAAC,CAAC,CAAC;IAE1B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI;QAGI,WAAY,IAAgB;YACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACrB,CAAC;QACL,QAAC;IAAD,CAAC,AAND,IAMC;IAED,IAAM,CAAC,GAAG,IAAI,CAAC,CAAC,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC,CAAC;IAE5B,IAAA,eAAM,EAAC,IAAA,6BAAa,EAAC,CAAC,CAAC,CAAC,CAAC;IAEzB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IAKI,IAAM,CAAC,GAAM;QACT,MAAM,EAAE,cAAM,OAAA,IAAI,EAAJ,CAAI;KACrB,CAAC;IAEF,IAAA,eAAM,EAAC,IAAA,6BAAa,EAAC,CAAC,CAAC,CAAC,CAAC;IAEzB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B"} \ No newline at end of file diff --git a/test/mod.d.ts b/test/mod.d.ts new file mode 100644 index 0000000..58baed9 --- /dev/null +++ b/test/mod.d.ts @@ -0,0 +1,5 @@ +import "./withDefault"; +import "./flip"; +import "./objectKeys"; +import "./isPromiseLike"; +import "./assertIs"; diff --git a/test/mod.js b/test/mod.js new file mode 100644 index 0000000..735f178 --- /dev/null +++ b/test/mod.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +require("./withDefault"); +require("./flip"); +require("./objectKeys"); +require("./isPromiseLike"); +require("./assertIs"); +//# sourceMappingURL=mod.js.map \ No newline at end of file diff --git a/test/mod.js.map b/test/mod.js.map new file mode 100644 index 0000000..54439db --- /dev/null +++ b/test/mod.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/test/mod.ts"],"names":[],"mappings":";;AAAA,yBAAuB;AACvB,kBAAgB;AAChB,wBAAsB;AACtB,2BAAyB;AACzB,sBAAoB"} \ No newline at end of file diff --git a/test/objectEntries.types.d.ts b/test/objectEntries.types.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/objectEntries.types.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/objectEntries.types.js b/test/objectEntries.types.js new file mode 100644 index 0000000..606ea70 --- /dev/null +++ b/test/objectEntries.types.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var objectEntries_1 = require("../objectEntries"); +var assert_1 = require("../assert"); +var Reflect_1 = require("../Reflect"); +{ + var input = (0, Reflect_1.Reflect)(); + var got = (0, objectEntries_1.objectEntries)(input); + (0, assert_1.assert)(); +} +{ + var input = (0, Reflect_1.Reflect)(); + var got = (0, objectEntries_1.objectEntries)(input); + (0, assert_1.assert)(); +} +{ + var input = { + "a": "foo", + "b": 33, + "c": true, + }; + (0, assert_1.assert)(); + var got = (0, objectEntries_1.objectEntries)(input); + (0, assert_1.assert)(); +} +{ + var input = {}; + var got = (0, objectEntries_1.objectEntries)(input); + (0, assert_1.assert)(); +} +{ + (0, assert_1.assert)(); +} +{ + (0, assert_1.assert)(); +} +//# sourceMappingURL=objectEntries.types.js.map \ No newline at end of file diff --git a/test/objectEntries.types.js.map b/test/objectEntries.types.js.map new file mode 100644 index 0000000..f6910bc --- /dev/null +++ b/test/objectEntries.types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"objectEntries.types.js","sourceRoot":"","sources":["../src/test/objectEntries.types.ts"],"names":[],"mappings":";;AACA,kDAAiD;AACjD,oCAAmC;AACnC,sCAAqC;AAErC;IACI,IAAM,KAAK,GAAG,IAAA,iBAAO,GAIjB,CAAC;IAEL,IAAM,GAAG,GAAG,IAAA,6BAAa,EAAC,KAAK,CAAC,CAAC;IAIjC,IAAA,eAAM,GAAgC,CAAC;CAC1C;AAED;IACI,IAAM,KAAK,GAAG,IAAA,iBAAO,GAIjB,CAAC;IAEL,IAAM,GAAG,GAAG,IAAA,6BAAa,EAAC,KAAK,CAAC,CAAC;IAIjC,IAAA,eAAM,GAAgC,CAAC;CAC1C;AAED;IACI,IAAM,KAAK,GAAG;QACV,GAAG,EAAE,KAAK;QACV,GAAG,EAAE,EAAE;QACP,GAAG,EAAE,IAAI;KACH,CAAC;IAEX,IAAA,eAAM,GAAiF,CAAC;IAExF,IAAM,GAAG,GAAG,IAAA,6BAAa,EAAC,KAAK,CAAC,CAAC;IAIjC,IAAA,eAAM,GAAgC,CAAC;CAC1C;AAED;IACI,IAAM,KAAK,GAAG,EAAE,CAAC;IAEjB,IAAM,GAAG,GAAG,IAAA,6BAAa,EAAC,KAAK,CAAC,CAAC;IAIjC,IAAA,eAAM,GAAgC,CAAC;CAC1C;AAED;IAOI,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IAOI,IAAA,eAAM,GAAyB,CAAC;CACnC"} \ No newline at end of file diff --git a/test/objectFromEntries.types.d.ts b/test/objectFromEntries.types.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/objectFromEntries.types.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/objectFromEntries.types.js b/test/objectFromEntries.types.js new file mode 100644 index 0000000..ecdfc8e --- /dev/null +++ b/test/objectFromEntries.types.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var objectFromEntries_1 = require("../objectFromEntries"); +var assert_1 = require("../assert"); +var id_1 = require("../id"); +{ + var entries = [ + ["a", "foo"], + ["b", 33], + ["c", true], + ]; + var obj = (0, objectFromEntries_1.objectFromEntries)(entries); + (0, assert_1.assert)(); +} +{ + var entries = [ + ["a", (0, id_1.id)("foo")], + ["b", (0, id_1.id)(33)], + ["c", (0, id_1.id)(true)], + ]; + var obj = (0, objectFromEntries_1.objectFromEntries)(entries); + (0, assert_1.assert)(); +} +{ + (0, assert_1.assert)(); +} +//# sourceMappingURL=objectFromEntries.types.js.map \ No newline at end of file diff --git a/test/objectFromEntries.types.js.map b/test/objectFromEntries.types.js.map new file mode 100644 index 0000000..da89fdf --- /dev/null +++ b/test/objectFromEntries.types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"objectFromEntries.types.js","sourceRoot":"","sources":["../src/test/objectFromEntries.types.ts"],"names":[],"mappings":";;AACA,0DAAyD;AACzD,oCAAmC;AACnC,4BAA2B;AAE3B;IACI,IAAM,OAAO,GAAG;QACZ,CAAC,GAAG,EAAE,KAAK,CAAC;QACZ,CAAC,GAAG,EAAE,EAAE,CAAC;QACT,CAAC,GAAG,EAAE,IAAI,CAAC;KACL,CAAC;IAEX,IAAM,GAAG,GAAG,IAAA,qCAAiB,EAAC,OAAO,CAAC,CAAC;IAEvC,IAAA,eAAM,GASH,CAAC;CACP;AAED;IACI,IAAM,OAAO,GAAG;QACZ,CAAC,GAAG,EAAE,IAAA,OAAE,EAAS,KAAK,CAAC,CAAC;QACxB,CAAC,GAAG,EAAE,IAAA,OAAE,EAAS,EAAE,CAAC,CAAC;QACrB,CAAC,GAAG,EAAE,IAAA,OAAE,EAAU,IAAI,CAAC,CAAC;KAClB,CAAC;IAEX,IAAM,GAAG,GAAG,IAAA,qCAAiB,EAAC,OAAO,CAAC,CAAC;IAEvC,IAAA,eAAM,GASH,CAAC;CACP;AAED;IAKI,IAAA,eAAM,GAQH,CAAC;CACP"} \ No newline at end of file diff --git a/test/objectKeys.d.ts b/test/objectKeys.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/objectKeys.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/objectKeys.js b/test/objectKeys.js new file mode 100644 index 0000000..0a82a62 --- /dev/null +++ b/test/objectKeys.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var objectKeys_1 = require("../objectKeys"); +var assert_1 = require("../assert"); +var same_1 = require("evt/tools/inDepth/same"); +{ + var obj = { + "a": 1, + "b": 2, + "c": 3, + }; + var got = (0, objectKeys_1.objectKeys)(obj); + var expected = ["a", "b", "c"]; + (0, assert_1.assert)((0, same_1.same)(got, expected)); + console.log("PASS TEST 1"); +} +{ + var obj = { + "a": 1, + "b": 2, + "c": 3, + }; + var got = (0, objectKeys_1.objectKeys)(obj); + var expected = ["a", "b", "c"]; + (0, assert_1.assert)((0, same_1.same)(got, expected)); + console.log("PASS TEST 2"); +} +//# sourceMappingURL=objectKeys.js.map \ No newline at end of file diff --git a/test/objectKeys.js.map b/test/objectKeys.js.map new file mode 100644 index 0000000..f7d6451 --- /dev/null +++ b/test/objectKeys.js.map @@ -0,0 +1 @@ +{"version":3,"file":"objectKeys.js","sourceRoot":"","sources":["../src/test/objectKeys.ts"],"names":[],"mappings":";;AAAA,4CAA2C;AAC3C,oCAAmC;AACnC,+CAA8C;AAE9C;IAOI,IAAM,GAAG,GAAM;QACX,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,CAAC;KACT,CAAC;IAEF,IAAM,GAAG,GAAG,IAAA,uBAAU,EAAC,GAAG,CAAC,CAAC;IAE5B,IAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAEjC,IAAA,eAAM,EAAC,IAAA,WAAI,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI,IAAM,GAAG,GAAG;QACR,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,CAAC;KACT,CAAC;IAEF,IAAM,GAAG,GAAG,IAAA,uBAAU,EAA2B,GAAG,CAAC,CAAC;IAEtD,IAAM,QAAQ,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;IAEjC,IAAA,eAAM,EAAC,IAAA,WAAI,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B"} \ No newline at end of file diff --git a/test/objectKeys.types.d.ts b/test/objectKeys.types.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/objectKeys.types.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/objectKeys.types.js b/test/objectKeys.types.js new file mode 100644 index 0000000..ae70630 --- /dev/null +++ b/test/objectKeys.types.js @@ -0,0 +1,67 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +var objectKeys_1 = require("../objectKeys"); +var assert_1 = require("../assert"); +{ + var obj = { + "a": 1, + "b": "ok", + "c": null, + }; + var x = (0, objectKeys_1.objectKeys)(obj); + (0, assert_1.assert)(); +} +{ + var obj = { + "a": 1, + "b": "ok", + "c": null, + }; + var x = (0, objectKeys_1.objectKeys)(obj); + (0, assert_1.assert)(); +} +{ + var obj = { + "a": 1, + "b": "ok", + "c": null, + }; + //@ts-expect-error + var x = (0, objectKeys_1.objectKeys)(obj); +} +{ + var A = /** @class */ (function () { + function A(a, b, c) { + this.a = a; + this.b = b; + this.c = c; + } + return A; + }()); + var obj = new A(1, "ok", null); + //@ts-expect-error + var x = (0, objectKeys_1.objectKeys)(obj); +} +{ + var obj = {}; + var x = (0, objectKeys_1.objectKeys)(obj); + (0, assert_1.assert)(); +} +{ + var x = "ok"; + //@ts-expect-error + var got = (0, objectKeys_1.objectKeys)(x); +} +{ + var x = 1; + //@ts-expect-error + var got = (0, objectKeys_1.objectKeys)(x); +} +{ + var x = true; + //@ts-expect-error + var got = (0, objectKeys_1.objectKeys)(x); +} +//# sourceMappingURL=objectKeys.types.js.map \ No newline at end of file diff --git a/test/objectKeys.types.js.map b/test/objectKeys.types.js.map new file mode 100644 index 0000000..1cdf5bd --- /dev/null +++ b/test/objectKeys.types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"objectKeys.types.js","sourceRoot":"","sources":["../src/test/objectKeys.types.ts"],"names":[],"mappings":";;AAAA,sDAAsD;AACtD,sDAAsD;AACtD,4CAA2C;AAC3C,oCAAmC;AAGnC;IACI,IAAM,GAAG,GAAG;QACR,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,IAAI;QACT,GAAG,EAAE,IAAI;KACZ,CAAC;IAEF,IAAM,CAAC,GAAG,IAAA,uBAAU,EAAC,GAAG,CAAC,CAAC;IAM1B,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IAMI,IAAM,GAAG,GAAM;QACX,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,IAAI;QACT,GAAG,EAAE,IAAI;KACZ,CAAC;IAEF,IAAM,CAAC,GAAG,IAAA,uBAAU,EAA2B,GAAG,CAAC,CAAC;IAMpD,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IAOI,IAAM,GAAG,GAAM;QACX,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,IAAI;QACT,GAAG,EAAE,IAAI;KACZ,CAAC;IAEF,kBAAkB;IAClB,IAAM,CAAC,GAAG,IAAA,uBAAU,EAAC,GAAG,CAAC,CAAC;CAC7B;AAED;IACI;QAKI,WAAY,CAAS,EAAE,CAAS,EAAE,CAAO;YACrC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YACX,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACf,CAAC;QACL,QAAC;IAAD,CAAC,AAVD,IAUC;IAED,IAAM,GAAG,GAAM,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAEpC,kBAAkB;IAClB,IAAM,CAAC,GAAG,IAAA,uBAAU,EAAC,GAAG,CAAC,CAAC;CAC7B;AAED;IACI,IAAM,GAAG,GAAG,EAAE,CAAC;IAEf,IAAM,CAAC,GAAG,IAAA,uBAAU,EAAC,GAAG,CAAC,CAAC;IAM1B,IAAA,eAAM,GAAyB,CAAC;CACnC;AAED;IACI,IAAM,CAAC,GAAG,IAAI,CAAC;IAEf,kBAAkB;IAClB,IAAM,GAAG,GAAG,IAAA,uBAAU,EAAC,CAAC,CAAC,CAAC;CAC7B;AAED;IACI,IAAM,CAAC,GAAG,CAAC,CAAC;IAEZ,kBAAkB;IAClB,IAAM,GAAG,GAAG,IAAA,uBAAU,EAAC,CAAC,CAAC,CAAC;CAC7B;AAED;IACI,IAAM,CAAC,GAAG,IAAI,CAAC;IAEf,kBAAkB;IAClB,IAAM,GAAG,GAAG,IAAA,uBAAU,EAAC,CAAC,CAAC,CAAC;CAC7B"} \ No newline at end of file diff --git a/test/withDefault.d.ts b/test/withDefault.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/withDefault.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/withDefault.js b/test/withDefault.js new file mode 100644 index 0000000..8acd2ca --- /dev/null +++ b/test/withDefault.js @@ -0,0 +1,89 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +/* eslint-disable @typescript-eslint/ban-ts-comment */ +var withDefaults_1 = require("../lab/withDefaults"); +var same_1 = require("evt/tools/inDepth/same"); +var assert_1 = require("../assert"); +{ + var f = function (params) { + var foo = params.foo, bar = params.bar; + return "".concat(foo, " ").concat(bar); + }; + var got = (0, withDefaults_1.withDefaults)(f, { "foo": "xxx" })({ "bar": 44 }); + var expected = "xxx 44"; + (0, assert_1.assert)(got === expected); + console.log("PASS TEST 1"); +} +{ + var f = function (params) { + return params; + }; + var got = (0, withDefaults_1.withDefaults)(f, { "a": 44 })({ "defaultsOverwrite": { "a": [33] }, "b": 22 }); + var expected = { + "a": 33, + "b": 22, + }; + (0, assert_1.assert)((0, same_1.same)(got, expected)); + console.log("PASS TEST 2"); +} +{ + var f = function (params) { + return params; + }; + var got = (0, withDefaults_1.withDefaults)(f, { "a": 44 })({}); + var expected = { + "a": 44, + "b": undefined, + }; + (0, assert_1.assert)((0, same_1.same)(got, expected)); + console.log("PASS TEST 3"); +} +{ + var f = function (params) { + var a = params.a, b = params.b; + return "".concat(a).concat(b); + }; + var fWd = (0, withDefaults_1.withDefaults)(f, { "a": 44 }); + var got = fWd({ "b": 33 }) + fWd({ "b": 12 }); + var expected = "44334412"; + (0, assert_1.assert)(got === expected); + console.log("PASS TEST 4"); +} +{ + var f = function (params) { + var a = params.a, b = params.b; + return "".concat(a).concat(b); + }; + var fWd = (0, withDefaults_1.withDefaults)(f, { "a": 44 }); + var got = fWd({ "defaultsOverwrite": { "a": undefined }, "b": 33 }); + var expected = "4433"; + (0, assert_1.assert)(got === expected); + console.log("PASS TEST 5"); +} +{ + var f = function (params) { + return params; + }; + var fWd = (0, withDefaults_1.withDefaults)(f, { "a": 33 }); + var got = fWd({ "b": 44, "defaultsOverwrite": { "a": [undefined] } }); + var expected = { + "a": undefined, + "b": 44, + }; + (0, assert_1.assert)((0, same_1.same)(got, expected)); + console.log("PASS TEST 6"); +} +{ + var f = function (params) { + return params; + }; + var fWd = (0, withDefaults_1.withDefaults)(f, { "a": 33 }); + var got = fWd({ "b": 44, "defaultsOverwrite": { "a": [undefined] } }); + var expected = { + "a": undefined, + "b": 44, + }; + (0, assert_1.assert)((0, same_1.same)(got, expected)); + console.log("PASS TEST 7"); +} +//# sourceMappingURL=withDefault.js.map \ No newline at end of file diff --git a/test/withDefault.js.map b/test/withDefault.js.map new file mode 100644 index 0000000..d3e5499 --- /dev/null +++ b/test/withDefault.js.map @@ -0,0 +1 @@ +{"version":3,"file":"withDefault.js","sourceRoot":"","sources":["../src/test/withDefault.ts"],"names":[],"mappings":";;AAAA,sDAAsD;AACtD,oDAAmD;AACnD,+CAA8C;AAC9C,oCAAmC;AAEnC;IACI,IAAM,CAAC,GAAG,UAAC,MAAoC;QACnC,IAAA,GAAG,GAAU,MAAM,IAAhB,EAAE,GAAG,GAAK,MAAM,IAAX,CAAY;QAC5B,OAAO,UAAG,GAAG,cAAI,GAAG,CAAE,CAAC;IAC3B,CAAC,CAAC;IAEF,IAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;IAE7D,IAAM,QAAQ,GAAG,QAAQ,CAAC;IAE1B,IAAA,eAAM,EAAC,GAAG,KAAK,QAAQ,CAAC,CAAC;IAEzB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI,IAAM,CAAC,GAAG,UAAC,MAAgC;QACvC,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;IAEF,IAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,mBAAmB,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IAE1F,IAAM,QAAQ,GAAG;QACb,GAAG,EAAE,EAAE;QACP,GAAG,EAAE,EAAE;KACV,CAAC;IAEF,IAAA,eAAM,EAAC,IAAA,WAAI,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI,IAAM,CAAC,GAAG,UAAC,MAAkC;QACzC,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;IAEF,IAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IAC7C,IAAM,QAAQ,GAAG;QACb,GAAG,EAAE,EAAE;QACP,GAAG,EAAE,SAAS;KACjB,CAAC;IAEF,IAAA,eAAM,EAAC,IAAA,WAAI,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI,IAAM,CAAC,GAAG,UAAC,MAAgC;QAC/B,IAAA,CAAC,GAAQ,MAAM,EAAd,EAAE,CAAC,GAAK,MAAM,EAAX,CAAY;QACxB,OAAO,UAAG,CAAC,SAAG,CAAC,CAAE,CAAC;IACtB,CAAC,CAAC;IAEF,IAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IAEzC,IAAM,GAAG,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IAEhD,IAAM,QAAQ,GAAG,UAAU,CAAC;IAE5B,IAAA,eAAM,EAAC,GAAG,KAAK,QAAQ,CAAC,CAAC;IAEzB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI,IAAM,CAAC,GAAG,UAAC,MAAgC;QAC/B,IAAA,CAAC,GAAQ,MAAM,EAAd,EAAE,CAAC,GAAK,MAAM,EAAX,CAAY;QACxB,OAAO,UAAG,CAAC,SAAG,CAAC,CAAE,CAAC;IACtB,CAAC,CAAC;IAEF,IAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IACzC,IAAM,GAAG,GAAG,GAAG,CAAC,EAAE,mBAAmB,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IACtE,IAAM,QAAQ,GAAG,MAAM,CAAC;IAExB,IAAA,eAAM,EAAC,GAAG,KAAK,QAAQ,CAAC,CAAC;IAEzB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI,IAAM,CAAC,GAAG,UAAC,MAA4C;QACnD,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;IAEF,IAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IAEzC,IAAM,GAAG,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,mBAAmB,EAAE,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;IACxE,IAAM,QAAQ,GAAG;QACb,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,EAAE;KACV,CAAC;IAEF,IAAA,eAAM,EAAC,IAAA,WAAI,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B;AAED;IACI,IAAM,CAAC,GAAG,UAAC,MAAiC;QACxC,OAAO,MAAM,CAAC;IAClB,CAAC,CAAC;IAEF,IAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC,CAAC;IAEzC,IAAM,GAAG,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,mBAAmB,EAAE,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;IACxE,IAAM,QAAQ,GAAG;QACb,GAAG,EAAE,SAAS;QACd,GAAG,EAAE,EAAE;KACV,CAAC;IAEF,IAAA,eAAM,EAAC,IAAA,WAAI,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE5B,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;CAC9B"} \ No newline at end of file diff --git a/test/withDefaults.types.d.ts b/test/withDefaults.types.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/test/withDefaults.types.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/test/withDefaults.types.js b/test/withDefaults.types.js new file mode 100644 index 0000000..c6614f8 --- /dev/null +++ b/test/withDefaults.types.js @@ -0,0 +1,64 @@ +"use strict"; +/* eslint-disable @typescript-eslint/ban-ts-comment */ +/* eslint-disable @typescript-eslint/no-unused-vars */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +var assert_1 = require("../assert"); +var withDefaults_1 = require("../lab/withDefaults"); +var x = null; +//@ts-ignore +function test() { + var f = x(); + var got = (0, withDefaults_1.withDefaults)(f, { "foo": x() }); + var expected = x(); + (0, assert_1.assert)(); +} +//@ts-ignore +function test() { + var f = x(); + var got = (0, withDefaults_1.withDefaults)(f, { "foo": x() }); + var expected = x(); + (0, assert_1.assert)(); +} +//@ts-ignore +function test() { + var f = x(); + var got = (0, withDefaults_1.withDefaults)(f, { "foo": x() }); + var expected = x(); + (0, assert_1.assert)(); +} +//@ts-ignore +function test() { + // eslint-disable-next-line @typescript-eslint/ban-types + var f = null; + //@ts-expect-error + (0, withDefaults_1.withDefaults)(f, { "foo": null }); +} +//@ts-ignore +function test() { + // eslint-disable-next-line @typescript-eslint/ban-types + var f = null; + //@ts-expect-error + (0, withDefaults_1.withDefaults)(f, { "foo": null }); +} +//@ts-ignore +function test() { + // eslint-disable-next-line @typescript-eslint/ban-types + var f = null; + (0, withDefaults_1.withDefaults)(f, {}); +} +//@ts-ignore +function test() { + // eslint-disable-next-line @typescript-eslint/ban-types + var f = null; + //@ts-expect-error + (0, withDefaults_1.withDefaults)(f, { "foo": null, "baz": "" }); +} +//@ts-ignore +function test() { + var f = x(); + var fWd = (0, withDefaults_1.withDefaults)(f, { "a": x() }); + //@ts-expect-error + var got = fWd({ "b": x(), "defaultsOverwrite": { "a": [undefined] } }); +} +//# sourceMappingURL=withDefaults.types.js.map \ No newline at end of file diff --git a/test/withDefaults.types.js.map b/test/withDefaults.types.js.map new file mode 100644 index 0000000..976b76d --- /dev/null +++ b/test/withDefaults.types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"withDefaults.types.js","sourceRoot":"","sources":["../src/test/withDefaults.types.ts"],"names":[],"mappings":";AAAA,sDAAsD;AACtD,sDAAsD;AACtD,uDAAuD;;AAEvD,oCAAmC;AACnC,oDAAmD;AAGnD,IAAM,CAAC,GAAe,IAAW,CAAC;AAElC,YAAY;AACZ,SAAS,IAAI;IACT,IAAM,CAAC,GAAkD,CAAC,EAAO,CAAC;IAClE,IAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,EAAK,EAAE,CAAC,CAAC;IAE/C,IAAM,QAAQ,GAQL,CAAC,EAAO,CAAC;IAElB,IAAA,eAAM,GAAuC,CAAC;AAClD,CAAC;AAED,YAAY;AACZ,SAAS,IAAI;IACT,IAAM,CAAC,GAAsC,CAAC,EAAO,CAAC;IACtD,IAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,EAAK,EAAE,CAAC,CAAC;IAE/C,IAAM,QAAQ,GAQL,CAAC,EAAO,CAAC;IAElB,IAAA,eAAM,GAAuC,CAAC;AAClD,CAAC;AAED,YAAY;AACZ,SAAS,IAAI;IACT,IAAM,CAAC,GAAuC,CAAC,EAAO,CAAC;IACvD,IAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,EAAK,EAAE,CAAC,CAAC;IAE/C,IAAM,QAAQ,GAQL,CAAC,EAAO,CAAC;IAElB,IAAA,eAAM,GAAuC,CAAC;AAClD,CAAC;AAED,YAAY;AACZ,SAAS,IAAI;IACT,wDAAwD;IACxD,IAAM,CAAC,GAAsB,IAAW,CAAC;IAEzC,kBAAkB;IAClB,IAAA,2BAAY,EAAC,CAAC,EAAE,EAAE,KAAK,EAAE,IAAW,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,YAAY;AACZ,SAAS,IAAI;IACT,wDAAwD;IACxD,IAAM,CAAC,GAAmC,IAAW,CAAC;IAEtD,kBAAkB;IAClB,IAAA,2BAAY,EAAC,CAAC,EAAE,EAAE,KAAK,EAAE,IAAW,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED,YAAY;AACZ,SAAS,IAAI;IACT,wDAAwD;IACxD,IAAM,CAAC,GAAsB,IAAW,CAAC;IAEzC,IAAA,2BAAY,EAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACxB,CAAC;AAED,YAAY;AACZ,SAAS,IAAI;IACT,wDAAwD;IACxD,IAAM,CAAC,GAAgD,IAAW,CAAC;IAEnE,kBAAkB;IAClB,IAAA,2BAAY,EAAC,CAAC,EAAE,EAAE,KAAK,EAAE,IAAW,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;AACvD,CAAC;AAED,YAAY;AACZ,SAAS,IAAI;IACT,IAAM,CAAC,GAAkC,CAAC,EAAO,CAAC;IAElD,IAAM,GAAG,GAAG,IAAA,2BAAY,EAAC,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,EAAO,EAAE,CAAC,CAAC;IAE/C,kBAAkB;IAClB,IAAM,GAAG,GAAG,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,EAAO,EAAE,mBAAmB,EAAE,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC,CAAC;AAClF,CAAC"} \ 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/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..996ad5c --- /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","../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/test/Equals.ts","../src/test/Extends.ts","../src/test/MethodNames.ts","../src/test/Parameters.ts","../src/test/Params0.ts","../src/test/PickOptionals.ts","../src/test/PickRequired.ts","../src/test/ReturnType.ts","../src/test/UnionToIntersection.types.ts","../src/test/UnpackPromise.ts","../src/test/UnpackTypeGuard.ts","../src/test/assertIs.ts","../node_modules/minimal-polyfills/Object.is.d.ts","../node_modules/evt/tools/inDepth/same.d.ts","../src/test/exclude.ts","../src/test/exclude.types.ts","../src/test/flip.ts","../src/test/flip.type.ts","../src/tools/getProjectRoot.ts","../src/test/getProjectRoot.ts","../src/test/id.ts","../node_modules/evt/tools/Deferred.d.ts","../src/test/index.ts","../src/test/isPromiseLike.ts","../src/test/withDefault.ts","../src/test/objectKeys.ts","../src/test/mod.ts","../src/test/objectEntries.types.ts","../src/test/objectFromEntries.types.ts","../src/test/objectKeys.types.ts","../src/test/withDefaults.types.ts","../src/tools/toUpperCase.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":"d5c0ac6a5965e46d089b3dab85a41a68d51f199a095c5a35c1b39fd15d31bc3c","affectsGlobalScope":true},"e8d2e50f9e8fdd312d31f97571b4c7295b8f29f7f8363498edae2a9eb113ee36","4b1854aec637e8e041eff02899e16fd3c0c78685c622336aadfd67e6604bbe1b","d6f7d47355a0167969e9a8eedfb0994f21e038d360965ec06c30f6871038900b","4735756aff7c5857de387f321633f272e2daba4950c427ab200de954340c7c13","13dfb22c1b46f9858b19fc7df54674146f3d174ccd35f0e02e8d05a3026b9ba8","33d21bcca0f7b054d0d0d402125f547c9ac77782c2df301de314143f08e81406",{"version":"b7f90b66a152a20964d4020a56c2e7db4afe37b9ce4609552bf643810f745e8b","affectsGlobalScope":true},{"version":"55cc4ba886da5b6b225abf48d4fa10fa2762d22dc4ed8864cca2621ac70e7e66","affectsGlobalScope":true},{"version":"3523038578cadf637fdce58f06018e144fd5b26c12e3f9c1cef14cdf92ca3d20","affectsGlobalScope":true},{"version":"28065193ddf88bf697915b9236d2d00a27e85726563e88474f166790376e10d8","affectsGlobalScope":true},{"version":"511c964513d7c2f72556554cdeb960b4f0445990d11080297a97cc7b5fa1bb68","affectsGlobalScope":true},{"version":"725daac09ec6eb9086c2bea6bbdf6d6ab2a6f49d686656c6021a4da0415fe31f","affectsGlobalScope":true},{"version":"21574b67bbedcb39a6efa00ca47e5b9402946a4d4e890abd5b51d3fd371819ba","affectsGlobalScope":true},{"version":"2415a2b1a4a521594b9837316ae3950b0c0c2f8b689defd358986bf3e263e904","affectsGlobalScope":true},{"version":"e5d8d715990d96a37f3521a3f1460679507b261eec1b42dc84d4de835997b794","affectsGlobalScope":true},{"version":"93fa2a84417c65ab8ed121a0b84536312e00a11cbf45b0006a75324d00b176d2","affectsGlobalScope":true},{"version":"a003a6051b48dc64eaa8ad83789e4c2a540f3482bed821053b6770969bd598fb","affectsGlobalScope":true},{"version":"e90857fa86cecc3bc964a2d7db9d95a0c406bebfadeb4853a01a0079936f12f7","affectsGlobalScope":true},{"version":"8bbb03589e48f10b49996064f35256e858d205dcb364428fb4cc045061b1d786","affectsGlobalScope":true},{"version":"5044747370afee4b4c247e8a14c2969d245bbcf8396295dc5a60c659d796a71f","affectsGlobalScope":true},{"version":"8e4921934f4bec04df1bee5762a8f4ad9213f0dab33ea10c5bb1ba1201070c6a","affectsGlobalScope":true},{"version":"a894424c7058bcc77c1a3c92fe289c0ff93792e583e064c683d021879479f7b8","affectsGlobalScope":true},{"version":"8f03386d697248c5d356fd53f2729b920ea124cd1414a6c22de03c5d24729277","affectsGlobalScope":true},{"version":"21ac76354ecc1324ee2e31ac5fcebfa91b1b6beb3e8c3fe6f3988538e9629c73","affectsGlobalScope":true},{"version":"0f71e010899461f256a976d1bece8f39710a8661ced0ae3a4a757f61e0b0200d","affectsGlobalScope":true},{"version":"fe7acdc1039eca904399190766d1c8766b7d2621413f972c8542dddd69612097","affectsGlobalScope":true},{"version":"c25aa843b930662d62f0e853dd1f347d08b66cdec09bd760151d4ba6ce220fe6","affectsGlobalScope":true},{"version":"3e47477f297e4fa0d556c40a872c2c45bddefa487fd054bf1f80bceb527a682b","affectsGlobalScope":true},{"version":"a902be9f4116b449dbac07ffe3f4d69abb664f8eddfaeb892225612469213788","affectsGlobalScope":true},{"version":"155d8d1e367e05af5e5708a860825785f00eabae01744cf7bc569664301415a4","affectsGlobalScope":true},{"version":"5b30b81cdeb239772daf44e6c0d5bf6adec9dbf8d534ed25c9a0e8a43b9abfff","affectsGlobalScope":true},{"version":"cdb77abf1220d79a20508bbcfddf21f0437ea8ef5939ba46f999c4987061baab","affectsGlobalScope":true},{"version":"62e02a2f5889850ed658dfde861b2ba84fb22f3663ea3b2e2f7fb3dcd1813431","affectsGlobalScope":true},{"version":"357921f26d612a4c5ac9896340e6a2beffcaf889ff5cdfcc742e9af804d1a448","affectsGlobalScope":true},{"version":"d836a4258d6b5ee12054b802002d7c9c5eb6a1adb6a654f0ee9429cbda03e1a0","affectsGlobalScope":true},{"version":"c021bff90eb33d29edfde16c9b861097bbf99aa290726d0d0ac65330aa7be85a","affectsGlobalScope":true},{"version":"1c4e64dc374ea5922d7632a52b167187ba7c7e35b34d3c1e22625be66ca1576d","affectsGlobalScope":true},{"version":"cd1bebc4db8fb52c5618ecad3f511f62c78921451c198220c5b2ee5610b4d7b9","affectsGlobalScope":true},{"version":"fb60e7c9de1306648f865b4c8ef76b7376731af3955b69551004ad3848fb8f4c","affectsGlobalScope":true},{"version":"18d23591bba5678cf57ef139e1a3daad8017b26ad6612c8c34d6fa39044b245f","affectsGlobalScope":true},{"version":"a0c22cc020e4812220d19113592740068675a7fdebc2622ffdba49acc338178f","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"},{"version":"48932b2f414810c7f777d7243f8ec71de008c2eaa8fb0772acaebeddbee9faa7","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"4d4e2da4f4d948527f18307c13c045ef4aed8458e5947b24e8a68000552b9f23","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"8148e643aa695f617428a04332050a8a9d9d775489f057a1f31bea0b60519b6e","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"4c3dda5bda8473ef884047618fdbd10538bcf7bb348f1e8b3b1d3ece2bfb9567","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"98a67a7a585ee4be6c39fce190e7c8292cd98529bf623ac44edf6824b16f6b67","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"fb1410bf806be4356858f0f0cbd184746a4103bcd1693c88be6f17fc05601372","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"e0b5a2c0cc9aa809d08327e7643c7214cfa64a113cca1083b192046a0bc68031","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"e313fb7dd26f125ad04082d589c0db02db11ab8889e8856d31c116b8b2984eee","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"56bf55913b2885a93152318830a7580adb45bbd6e7f0ad47f9f3c046961daed6","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"cf2483c1962c5e8612cd0d923511114042cac3489890a0e00b914ec192e3d42b","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"ac5f91a2718247ac42476c0e5f34f748788205cde9892196dd47fe87c7ea78bb","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"e874419687c48b604f85e37b46249c3c1371884fee4db62769cffe6584b63be0","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881","7e062925029f9b753515d9f6e0169e0cecc986925ffe8702bf0f0d141b2dde90",{"version":"cfff4a868c4616e4b2b5dbc85a561cdeb847af9e17920776f84148af62b7f58f","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"801e79902cd3198f596daafef0cd07b37916c834d71e3dc0978c83b484875285","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"854bc45a2e4885ab9eac4ebdab2980ed1a61318465e86b2e9790d63eecdab7b4","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"40fb5e86ac61631d96d5ea8b0180a4c8780c801a675fe6e3916f6a216896e798","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"3e6239b7b45d4c78f745b459e3a8493af4be6a5fc078cbc6c471d5db77902a06","signature":"200426c8d87ae866a7eb0e9ce577ebd7b9437df0f4d166965840e01e96144eff"},{"version":"b68345c83adff2fb505ed5a627a4d7205be489277ff55a339bf3a60f319bd23f","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"24f06773909f32ae226ec3ec00f714b6b2cb1904af70f02a4203c3d9fbf15ba9","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},"fc633779ce49c0ea733d4a282d99462bb6c672c37db33584bafe130e792d55d6",{"version":"40132ea40ba8ee9c99225323d53f269c860b5b24c92a6a677a03c46596f338ba","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"7cfd6eb508986e0f29e36459fac92d6a6a8f205fe10e4d72c14aafb997065a46","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"e5200571f6b4f1f064d76510fd11d1b010cc37e01bbc344d69876cc6117d274f","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"d474c029d8749bdcf9a3cc0d5344affb5c4c8a07d28dbc6b555e04d4b56aba3e","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},"c4556181a264480a8a08eb14f3c1883489000a65b243e7dd1e13e704b02bb3b2",{"version":"36d1c8ada4dbc995b7071a727eae5b4fa742fb0401bf8299dd6bc80b00c183e0","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"1072fec26eaba1ee66cbdffb2a32b467575d48229d74c5de0e43c64f7e7cf18b","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"50475ed08c3945a4a7d6bf19cb7227fc6c136f5944b393d8392af2b6b517f237","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"717733d1ec283448981592c7b692295662ce5540ade5f82a6df3d1ecba6bb2e6","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"0f2ac3e73064d6a8ec7f3ef8c726ecc9bd2cc34045cf18b2ec8142790d75bbe7","signature":"55216b3caf3325c8aa65aab47b84e826fca2bb492e229733d5599cc2ba4958fe"},"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"],"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":[[159],[113,159],[116,159],[117,122,150,159],[118,129,130,137,147,158,159],[118,119,129,137,159],[120,159],[121,122,130,138,159],[122,147,155,159],[123,125,129,137,159],[124,159],[125,126,159],[129,159],[127,129,159],[129,130,131,147,158,159],[129,130,131,144,147,150,159],[159,163],[125,132,137,147,158,159],[129,130,132,133,137,147,155,158,159],[132,134,147,155,158,159],[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,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165],[129,135,159],[136,158,159],[125,129,137,147,159],[138,159],[139,159],[116,140,159],[141,157,159,163],[142,159],[143,159],[129,144,145,159],[144,146,159,161],[117,129,147,148,149,150,159],[117,147,149,159],[147,148,159],[150,159],[151,159],[129,153,154,159],[153,154,159],[122,137,147,155,159],[156,159],[137,157,159],[117,132,143,158,159],[122,159],[147,159,160],[159,161],[159,162],[117,122,129,131,140,147,158,159,161,163],[147,159,164],[91,159],[43,44,159],[44,159],[49,159],[51,159],[45,58,60,159],[45,46,47,48,49,50,51,52,53,54,55,56,57,59,61,62,63,64,65,66,67,68,69,70,71,159],[58,159],[59,61,159],[77,159],[43,44,45,61,159],[45,46,61,159],[45,47,61,159],[45,49,61,159],[45,50,61,159],[45,51,61,159],[45,52,61,159],[45,54,61,159],[55,61,72,159],[45,56,61,159],[45,61,75,159],[45,59,61,159],[61,63,92,159],[45,61,63,159],[61,64,159],[64,159],[97,159],[57,159],[100,118,139,159],[61,65,159],[90,95,102,103,104,159],[53,61,68,72,159],[57,61,69,72,159],[61,66,92,159],[45,61,66,159],[61,78,92,159],[45,61,78,159],[130,139,159],[43,44],[44],[49],[51],[45],[77]],"referencedMap":[[111,1],[112,1],[113,2],[114,2],[116,3],[117,4],[118,5],[119,6],[120,7],[121,8],[122,9],[123,10],[124,11],[125,12],[126,12],[128,13],[127,14],[129,13],[130,15],[131,16],[115,17],[165,1],[132,18],[133,19],[134,20],[166,21],[135,22],[136,23],[137,24],[138,25],[139,26],[140,27],[141,28],[142,29],[143,30],[144,31],[145,31],[146,32],[147,33],[149,34],[148,35],[150,36],[151,37],[152,1],[153,38],[154,39],[155,40],[156,41],[157,42],[158,43],[159,44],[160,45],[161,46],[162,47],[163,48],[164,49],[167,1],[100,1],[92,50],[91,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],[45,51],[46,52],[47,1],[48,1],[50,53],[49,1],[51,1],[52,54],[53,1],[54,1],[55,1],[56,1],[61,55],[62,1],[63,1],[64,1],[57,1],[72,56],[59,57],[65,1],[74,1],[75,1],[76,1],[60,58],[78,59],[70,1],[68,1],[69,1],[66,1],[73,1],[79,60],[80,61],[81,62],[82,63],[83,64],[84,65],[85,66],[86,67],[87,68],[88,69],[89,70],[90,71],[93,72],[94,73],[95,74],[96,75],[98,76],[99,77],[101,78],[102,79],[105,80],[106,81],[107,82],[104,83],[108,84],[103,85],[109,86],[77,1],[44,1],[43,1],[97,87],[110,1],[67,1],[71,1],[58,77]],"exportedModulesMap":[[111,1],[112,1],[113,2],[114,2],[116,3],[117,4],[118,5],[119,6],[120,7],[121,8],[122,9],[123,10],[124,11],[125,12],[126,12],[128,13],[127,14],[129,13],[130,15],[131,16],[115,17],[165,1],[132,18],[133,19],[134,20],[166,21],[135,22],[136,23],[137,24],[138,25],[139,26],[140,27],[141,28],[142,29],[143,30],[144,31],[145,31],[146,32],[147,33],[149,34],[148,35],[150,36],[151,37],[152,1],[153,38],[154,39],[155,40],[156,41],[157,42],[158,43],[159,44],[160,45],[161,46],[162,47],[163,48],[164,49],[167,1],[100,1],[92,50],[91,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],[45,88],[46,89],[48,1],[50,90],[52,91],[61,92],[72,56],[74,1],[78,93],[105,80]],"semanticDiagnosticsPerFile":[111,112,113,114,116,117,118,119,120,121,122,123,124,125,126,128,127,129,130,131,115,165,132,133,134,166,135,136,137,138,139,140,141,142,143,144,145,146,147,149,148,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,167,100,92,91,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,45,46,47,48,50,49,51,52,53,54,55,56,61,62,63,64,57,72,59,65,74,75,76,60,78,70,68,69,66,73,79,80,81,82,83,84,85,86,87,88,89,90,93,94,95,96,98,99,101,102,105,106,107,104,108,103,109,77,44,43,97,110,67,71,58]},"version":"5.0.0-dev.20230109"} \ 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