From fd0a89b607cd822f3a11d3ddef8bce0674a8e8e1 Mon Sep 17 00:00:00 2001 From: actions Date: Mon, 30 Sep 2024 15:57:03 +0000 Subject: [PATCH] Adding deno distribution files and moving files from /dist to / --- .github/workflows/ci.yaml | 147 --------- .gitignore | 46 +-- Equals.d.ts | 4 + Equals.js | 6 + Equals.js.map | 1 + Extends.d.ts | 7 + Extends.js | 3 + Extends.js.map | 1 + MethodNames.d.ts | 4 + MethodNames.js | 5 + MethodNames.js.map | 1 + Not.d.ts | 2 + Not.js | 3 + Not.js.map | 1 + Param0.d.ts | 7 + Param0.js | 4 + Param0.js.map | 1 + Parameters.d.ts | 2 + Parameters.js | 4 + Parameters.js.map | 1 + PickOptionals.d.ts | 10 + PickOptionals.js | 3 + PickOptionals.js.map | 1 + PickRequired.d.ts | 7 + PickRequired.js | 3 + PickRequired.js.map | 1 + Reflect.d.ts | 2 + Reflect.js | 10 + Reflect.js.map | 1 + ReturnType.d.ts | 2 + ReturnType.js | 10 + ReturnType.js.map | 1 + UnionToIntersection.d.ts | 2 + UnionToIntersection.js | 4 + UnionToIntersection.js.map | 1 + UnpackPromise.d.ts | 6 + UnpackPromise.js | 3 + UnpackPromise.js.map | 1 + assert.d.ts | 7 + assert.js | 83 +++++ assert.js.map | 1 + capitalize.d.ts | 2 + capitalize.js | 10 + capitalize.js.map | 1 + deno_dist/Equals.ts | 11 + deno_dist/Extends.ts | 24 ++ deno_dist/LICENSE | 21 ++ deno_dist/MethodNames.ts | 9 + deno_dist/Not.ts | 2 + deno_dist/Param0.ts | 14 + deno_dist/Parameters.ts | 5 + deno_dist/PickOptionals.ts | 13 + deno_dist/PickRequired.ts | 8 + deno_dist/README.md | 119 +++++++ deno_dist/Reflect.ts | 5 + deno_dist/ReturnType.ts | 12 + deno_dist/UnionToIntersection.ts | 8 + deno_dist/UnpackPromise.ts | 7 + deno_dist/assert.ts | 45 +++ deno_dist/capitalize.ts | 5 + deno_dist/exclude.ts | 19 ++ deno_dist/flip.ts | 20 ++ deno_dist/id.ts | 37 +++ deno_dist/index.ts | 26 ++ deno_dist/is.ts | 28 ++ deno_dist/isAmong.ts | 12 + deno_dist/isPromiseLike.ts | 4 + deno_dist/lab/PromiseOrNot.ts | 1 + deno_dist/lab/UnpackTypeGuard.ts | 5 + deno_dist/lab/defineAccessors.ts | 31 ++ deno_dist/lab/index.ts | 5 + deno_dist/lab/overwriteReadonlyProp.ts | 52 +++ deno_dist/lab/withDefaults.ts | 33 ++ deno_dist/mod.ts | 1 + deno_dist/noUndefined.ts | 24 ++ deno_dist/objectEntries.ts | 14 + deno_dist/objectFromEntries.ts | 13 + deno_dist/objectKeys.ts | 6 + deno_dist/symToStr.ts | 5 + deno_dist/tools/Object.fromEntries.ts | 23 ++ deno_dist/tools/StrictEquals.ts | 2 + deno_dist/tools/Unite.ts | 1 + deno_dist/tools/getProjectRoot.ts | 45 +++ deno_dist/tools/index.ts | 5 + deno_dist/tools/toUpperCase.ts | 3 + deno_dist/typeGuard.ts | 7 + deno_dist/uncapitalize.ts | 5 + deno_dist/zz_internal/assertIsRefWrapper.ts | 5 + esm/Equals.d.ts | 4 + esm/Equals.mjs | 5 + esm/Equals.mjs.map | 1 + esm/Extends.d.ts | 7 + esm/Extends.mjs | 2 + esm/Extends.mjs.map | 1 + esm/MethodNames.d.ts | 4 + esm/MethodNames.mjs | 4 + esm/MethodNames.mjs.map | 1 + esm/Not.d.ts | 2 + esm/Not.mjs | 2 + esm/Not.mjs.map | 1 + esm/Param0.d.ts | 7 + esm/Param0.mjs | 3 + esm/Param0.mjs.map | 1 + esm/Parameters.d.ts | 2 + esm/Parameters.mjs | 3 + esm/Parameters.mjs.map | 1 + esm/PickOptionals.d.ts | 10 + esm/PickOptionals.mjs | 2 + esm/PickOptionals.mjs.map | 1 + esm/PickRequired.d.ts | 7 + esm/PickRequired.mjs | 2 + esm/PickRequired.mjs.map | 1 + esm/Reflect.d.ts | 2 + esm/Reflect.mjs | 6 + esm/Reflect.mjs.map | 1 + esm/ReturnType.d.ts | 2 + esm/ReturnType.mjs | 9 + esm/ReturnType.mjs.map | 1 + esm/UnionToIntersection.d.ts | 2 + esm/UnionToIntersection.mjs | 3 + esm/UnionToIntersection.mjs.map | 1 + esm/UnpackPromise.d.ts | 6 + esm/UnpackPromise.mjs | 2 + esm/UnpackPromise.mjs.map | 1 + esm/assert.d.ts | 7 + esm/assert.mjs | 79 +++++ esm/assert.mjs.map | 1 + esm/capitalize.d.ts | 2 + esm/capitalize.mjs | 6 + esm/capitalize.mjs.map | 1 + esm/exclude.d.ts | 6 + esm/exclude.mjs | 15 + esm/exclude.mjs.map | 1 + esm/flip.d.ts | 10 + esm/flip.mjs | 13 + esm/flip.mjs.map | 1 + esm/id.d.ts | 36 +++ esm/id.mjs | 3 + esm/id.mjs.map | 1 + esm/index.d.ts | 26 ++ esm/index.mjs | 16 + esm/index.mjs.map | 1 + esm/is.d.ts | 1 + esm/is.mjs | 22 ++ esm/is.mjs.map | 1 + esm/isAmong.d.ts | 2 + esm/isAmong.mjs | 32 ++ esm/isAmong.mjs.map | 1 + esm/isPromiseLike.d.ts | 1 + esm/isPromiseLike.mjs | 5 + esm/isPromiseLike.mjs.map | 1 + esm/lab/PromiseOrNot.d.ts | 1 + esm/lab/PromiseOrNot.mjs | 2 + esm/lab/PromiseOrNot.mjs.map | 1 + esm/lab/UnpackTypeGuard.d.ts | 1 + esm/lab/UnpackTypeGuard.mjs | 3 + esm/lab/UnpackTypeGuard.mjs.map | 1 + esm/lab/defineAccessors.d.ts | 4 + esm/lab/defineAccessors.mjs | 31 ++ esm/lab/defineAccessors.mjs.map | 1 + esm/lab/index.d.ts | 5 + esm/lab/index.mjs | 6 + esm/lab/index.mjs.map | 1 + esm/lab/overwriteReadonlyProp.d.ts | 7 + esm/lab/overwriteReadonlyProp.mjs | 48 +++ esm/lab/overwriteReadonlyProp.mjs.map | 1 + esm/lab/withDefaults.d.ts | 16 + esm/lab/withDefaults.mjs | 62 ++++ esm/lab/withDefaults.mjs.map | 1 + esm/noUndefined.d.ts | 9 + esm/noUndefined.mjs | 21 ++ esm/noUndefined.mjs.map | 1 + esm/objectEntries.d.ts | 8 + esm/objectEntries.mjs | 6 + esm/objectEntries.mjs.map | 1 + esm/objectFromEntries.d.ts | 8 + esm/objectFromEntries.mjs | 6 + esm/objectFromEntries.mjs.map | 1 + esm/objectKeys.d.ts | 2 + esm/objectKeys.mjs | 6 + esm/objectKeys.mjs.map | 1 + esm/symToStr.d.ts | 2 + esm/symToStr.mjs | 6 + esm/symToStr.mjs.map | 1 + esm/tools/Object.fromEntries.d.ts | 1 + esm/tools/Object.fromEntries.mjs | 34 ++ esm/tools/Object.fromEntries.mjs.map | 1 + esm/tools/StrictEquals.d.ts | 1 + esm/tools/StrictEquals.mjs | 2 + esm/tools/StrictEquals.mjs.map | 1 + esm/tools/Unite.d.ts | 3 + esm/tools/Unite.mjs | 2 + esm/tools/Unite.mjs.map | 1 + esm/tools/getProjectRoot.d.ts | 1 + esm/tools/getProjectRoot.mjs | 16 + esm/tools/getProjectRoot.mjs.map | 1 + esm/tools/index.d.ts | 5 + esm/tools/index.mjs | 6 + esm/tools/index.mjs.map | 1 + esm/tools/toUpperCase.d.ts | 1 + esm/tools/toUpperCase.mjs | 4 + esm/tools/toUpperCase.mjs.map | 1 + esm/tsconfig.esm.tsbuildinfo | 1 + esm/typeGuard.d.ts | 2 + esm/typeGuard.mjs | 7 + esm/typeGuard.mjs.map | 1 + esm/uncapitalize.d.ts | 2 + esm/uncapitalize.mjs | 6 + esm/uncapitalize.mjs.map | 1 + esm/zz_internal/assertIsRefWrapper.d.ts | 3 + esm/zz_internal/assertIsRefWrapper.mjs | 5 + esm/zz_internal/assertIsRefWrapper.mjs.map | 1 + exclude.d.ts | 6 + exclude.js | 19 ++ exclude.js.map | 1 + flip.d.ts | 10 + flip.js | 17 + flip.js.map | 1 + id.d.ts | 36 +++ id.js | 7 + id.js.map | 1 + index.d.ts | 26 ++ index.js | 32 ++ index.js.map | 1 + is.d.ts | 1 + is.js | 26 ++ is.js.map | 1 + isAmong.d.ts | 2 + isAmong.js | 36 +++ isAmong.js.map | 1 + isPromiseLike.d.ts | 1 + isPromiseLike.js | 9 + isPromiseLike.js.map | 1 + lab/PromiseOrNot.d.ts | 1 + lab/PromiseOrNot.js | 3 + lab/PromiseOrNot.js.map | 1 + lab/UnpackTypeGuard.d.ts | 1 + lab/UnpackTypeGuard.js | 4 + lab/UnpackTypeGuard.js.map | 1 + lab/defineAccessors.d.ts | 4 + lab/defineAccessors.js | 35 ++ lab/defineAccessors.js.map | 1 + lab/index.d.ts | 5 + lab/index.js | 22 ++ lab/index.js.map | 1 + lab/overwriteReadonlyProp.d.ts | 7 + lab/overwriteReadonlyProp.js | 52 +++ lab/overwriteReadonlyProp.js.map | 1 + lab/withDefaults.d.ts | 16 + lab/withDefaults.js | 66 ++++ lab/withDefaults.js.map | 1 + noUndefined.d.ts | 9 + noUndefined.js | 25 ++ noUndefined.js.map | 1 + objectEntries.d.ts | 8 + objectEntries.js | 10 + objectEntries.js.map | 1 + objectFromEntries.d.ts | 8 + objectFromEntries.js | 10 + objectFromEntries.js.map | 1 + objectKeys.d.ts | 2 + objectKeys.js | 10 + objectKeys.js.map | 1 + package.json | 334 ++++++++++++++++++-- symToStr.d.ts | 2 + symToStr.js | 10 + symToStr.js.map | 1 + tools/Object.fromEntries.d.ts | 1 + tools/Object.fromEntries.js | 35 ++ tools/Object.fromEntries.js.map | 1 + tools/StrictEquals.d.ts | 1 + tools/StrictEquals.js | 3 + tools/StrictEquals.js.map | 1 + tools/Unite.d.ts | 3 + tools/Unite.js | 3 + tools/Unite.js.map | 1 + tools/getProjectRoot.d.ts | 1 + tools/getProjectRoot.js | 43 +++ tools/getProjectRoot.js.map | 1 + tools/index.d.ts | 5 + tools/index.js | 22 ++ tools/index.js.map | 1 + tools/toUpperCase.d.ts | 1 + tools/toUpperCase.js | 8 + tools/toUpperCase.js.map | 1 + tsconfig.tsbuildinfo | 1 + typeGuard.d.ts | 2 + typeGuard.js | 11 + typeGuard.js.map | 1 + uncapitalize.d.ts | 2 + uncapitalize.js | 10 + uncapitalize.js.map | 1 + zz_internal/assertIsRefWrapper.d.ts | 3 + zz_internal/assertIsRefWrapper.js | 8 + zz_internal/assertIsRefWrapper.js.map | 1 + 295 files changed, 2782 insertions(+), 225 deletions(-) delete mode 100644 .github/workflows/ci.yaml create mode 100644 Equals.d.ts create mode 100644 Equals.js create mode 100644 Equals.js.map create mode 100644 Extends.d.ts create mode 100644 Extends.js create mode 100644 Extends.js.map create mode 100644 MethodNames.d.ts create mode 100644 MethodNames.js create mode 100644 MethodNames.js.map create mode 100644 Not.d.ts create mode 100644 Not.js create mode 100644 Not.js.map create mode 100644 Param0.d.ts create mode 100644 Param0.js create mode 100644 Param0.js.map create mode 100644 Parameters.d.ts create mode 100644 Parameters.js create mode 100644 Parameters.js.map create mode 100644 PickOptionals.d.ts create mode 100644 PickOptionals.js create mode 100644 PickOptionals.js.map create mode 100644 PickRequired.d.ts create mode 100644 PickRequired.js create mode 100644 PickRequired.js.map create mode 100644 Reflect.d.ts create mode 100644 Reflect.js create mode 100644 Reflect.js.map create mode 100644 ReturnType.d.ts create mode 100644 ReturnType.js create mode 100644 ReturnType.js.map create mode 100644 UnionToIntersection.d.ts create mode 100644 UnionToIntersection.js create mode 100644 UnionToIntersection.js.map create mode 100644 UnpackPromise.d.ts create mode 100644 UnpackPromise.js create mode 100644 UnpackPromise.js.map create mode 100644 assert.d.ts create mode 100644 assert.js create mode 100644 assert.js.map create mode 100644 capitalize.d.ts create mode 100644 capitalize.js create mode 100644 capitalize.js.map create mode 100644 deno_dist/Equals.ts create mode 100644 deno_dist/Extends.ts create mode 100644 deno_dist/LICENSE create mode 100644 deno_dist/MethodNames.ts create mode 100644 deno_dist/Not.ts create mode 100644 deno_dist/Param0.ts create mode 100644 deno_dist/Parameters.ts create mode 100644 deno_dist/PickOptionals.ts create mode 100644 deno_dist/PickRequired.ts create mode 100644 deno_dist/README.md create mode 100644 deno_dist/Reflect.ts create mode 100644 deno_dist/ReturnType.ts create mode 100644 deno_dist/UnionToIntersection.ts create mode 100644 deno_dist/UnpackPromise.ts create mode 100644 deno_dist/assert.ts create mode 100644 deno_dist/capitalize.ts create mode 100644 deno_dist/exclude.ts create mode 100644 deno_dist/flip.ts create mode 100644 deno_dist/id.ts create mode 100644 deno_dist/index.ts create mode 100644 deno_dist/is.ts create mode 100644 deno_dist/isAmong.ts create mode 100644 deno_dist/isPromiseLike.ts create mode 100644 deno_dist/lab/PromiseOrNot.ts create mode 100644 deno_dist/lab/UnpackTypeGuard.ts create mode 100644 deno_dist/lab/defineAccessors.ts create mode 100644 deno_dist/lab/index.ts create mode 100644 deno_dist/lab/overwriteReadonlyProp.ts create mode 100644 deno_dist/lab/withDefaults.ts create mode 100644 deno_dist/mod.ts create mode 100644 deno_dist/noUndefined.ts create mode 100644 deno_dist/objectEntries.ts create mode 100644 deno_dist/objectFromEntries.ts create mode 100644 deno_dist/objectKeys.ts create mode 100644 deno_dist/symToStr.ts create mode 100644 deno_dist/tools/Object.fromEntries.ts create mode 100644 deno_dist/tools/StrictEquals.ts create mode 100644 deno_dist/tools/Unite.ts create mode 100644 deno_dist/tools/getProjectRoot.ts create mode 100644 deno_dist/tools/index.ts create mode 100644 deno_dist/tools/toUpperCase.ts create mode 100644 deno_dist/typeGuard.ts create mode 100644 deno_dist/uncapitalize.ts create mode 100644 deno_dist/zz_internal/assertIsRefWrapper.ts create mode 100644 esm/Equals.d.ts create mode 100644 esm/Equals.mjs create mode 100644 esm/Equals.mjs.map create mode 100644 esm/Extends.d.ts create mode 100644 esm/Extends.mjs create mode 100644 esm/Extends.mjs.map create mode 100644 esm/MethodNames.d.ts create mode 100644 esm/MethodNames.mjs create mode 100644 esm/MethodNames.mjs.map create mode 100644 esm/Not.d.ts create mode 100644 esm/Not.mjs create mode 100644 esm/Not.mjs.map create mode 100644 esm/Param0.d.ts create mode 100644 esm/Param0.mjs create mode 100644 esm/Param0.mjs.map create mode 100644 esm/Parameters.d.ts create mode 100644 esm/Parameters.mjs create mode 100644 esm/Parameters.mjs.map create mode 100644 esm/PickOptionals.d.ts create mode 100644 esm/PickOptionals.mjs create mode 100644 esm/PickOptionals.mjs.map create mode 100644 esm/PickRequired.d.ts create mode 100644 esm/PickRequired.mjs create mode 100644 esm/PickRequired.mjs.map create mode 100644 esm/Reflect.d.ts create mode 100644 esm/Reflect.mjs create mode 100644 esm/Reflect.mjs.map create mode 100644 esm/ReturnType.d.ts create mode 100644 esm/ReturnType.mjs create mode 100644 esm/ReturnType.mjs.map create mode 100644 esm/UnionToIntersection.d.ts create mode 100644 esm/UnionToIntersection.mjs create mode 100644 esm/UnionToIntersection.mjs.map create mode 100644 esm/UnpackPromise.d.ts create mode 100644 esm/UnpackPromise.mjs create mode 100644 esm/UnpackPromise.mjs.map create mode 100644 esm/assert.d.ts create mode 100644 esm/assert.mjs create mode 100644 esm/assert.mjs.map create mode 100644 esm/capitalize.d.ts create mode 100644 esm/capitalize.mjs create mode 100644 esm/capitalize.mjs.map create mode 100644 esm/exclude.d.ts create mode 100644 esm/exclude.mjs create mode 100644 esm/exclude.mjs.map create mode 100644 esm/flip.d.ts create mode 100644 esm/flip.mjs create mode 100644 esm/flip.mjs.map create mode 100644 esm/id.d.ts create mode 100644 esm/id.mjs create mode 100644 esm/id.mjs.map create mode 100644 esm/index.d.ts create mode 100644 esm/index.mjs create mode 100644 esm/index.mjs.map create mode 100644 esm/is.d.ts create mode 100644 esm/is.mjs create mode 100644 esm/is.mjs.map create mode 100644 esm/isAmong.d.ts create mode 100644 esm/isAmong.mjs create mode 100644 esm/isAmong.mjs.map create mode 100644 esm/isPromiseLike.d.ts create mode 100644 esm/isPromiseLike.mjs create mode 100644 esm/isPromiseLike.mjs.map create mode 100644 esm/lab/PromiseOrNot.d.ts create mode 100644 esm/lab/PromiseOrNot.mjs create mode 100644 esm/lab/PromiseOrNot.mjs.map create mode 100644 esm/lab/UnpackTypeGuard.d.ts create mode 100644 esm/lab/UnpackTypeGuard.mjs create mode 100644 esm/lab/UnpackTypeGuard.mjs.map create mode 100644 esm/lab/defineAccessors.d.ts create mode 100644 esm/lab/defineAccessors.mjs create mode 100644 esm/lab/defineAccessors.mjs.map create mode 100644 esm/lab/index.d.ts create mode 100644 esm/lab/index.mjs create mode 100644 esm/lab/index.mjs.map create mode 100644 esm/lab/overwriteReadonlyProp.d.ts create mode 100644 esm/lab/overwriteReadonlyProp.mjs create mode 100644 esm/lab/overwriteReadonlyProp.mjs.map create mode 100644 esm/lab/withDefaults.d.ts create mode 100644 esm/lab/withDefaults.mjs create mode 100644 esm/lab/withDefaults.mjs.map create mode 100644 esm/noUndefined.d.ts create mode 100644 esm/noUndefined.mjs create mode 100644 esm/noUndefined.mjs.map create mode 100644 esm/objectEntries.d.ts create mode 100644 esm/objectEntries.mjs create mode 100644 esm/objectEntries.mjs.map create mode 100644 esm/objectFromEntries.d.ts create mode 100644 esm/objectFromEntries.mjs create mode 100644 esm/objectFromEntries.mjs.map create mode 100644 esm/objectKeys.d.ts create mode 100644 esm/objectKeys.mjs create mode 100644 esm/objectKeys.mjs.map create mode 100644 esm/symToStr.d.ts create mode 100644 esm/symToStr.mjs create mode 100644 esm/symToStr.mjs.map create mode 100644 esm/tools/Object.fromEntries.d.ts create mode 100644 esm/tools/Object.fromEntries.mjs create mode 100644 esm/tools/Object.fromEntries.mjs.map create mode 100644 esm/tools/StrictEquals.d.ts create mode 100644 esm/tools/StrictEquals.mjs create mode 100644 esm/tools/StrictEquals.mjs.map create mode 100644 esm/tools/Unite.d.ts create mode 100644 esm/tools/Unite.mjs create mode 100644 esm/tools/Unite.mjs.map create mode 100644 esm/tools/getProjectRoot.d.ts create mode 100644 esm/tools/getProjectRoot.mjs create mode 100644 esm/tools/getProjectRoot.mjs.map create mode 100644 esm/tools/index.d.ts create mode 100644 esm/tools/index.mjs create mode 100644 esm/tools/index.mjs.map create mode 100644 esm/tools/toUpperCase.d.ts create mode 100644 esm/tools/toUpperCase.mjs create mode 100644 esm/tools/toUpperCase.mjs.map create mode 100644 esm/tsconfig.esm.tsbuildinfo create mode 100644 esm/typeGuard.d.ts create mode 100644 esm/typeGuard.mjs create mode 100644 esm/typeGuard.mjs.map create mode 100644 esm/uncapitalize.d.ts create mode 100644 esm/uncapitalize.mjs create mode 100644 esm/uncapitalize.mjs.map create mode 100644 esm/zz_internal/assertIsRefWrapper.d.ts create mode 100644 esm/zz_internal/assertIsRefWrapper.mjs create mode 100644 esm/zz_internal/assertIsRefWrapper.mjs.map create mode 100644 exclude.d.ts create mode 100644 exclude.js create mode 100644 exclude.js.map create mode 100644 flip.d.ts create mode 100644 flip.js create mode 100644 flip.js.map create mode 100644 id.d.ts create mode 100644 id.js create mode 100644 id.js.map create mode 100644 index.d.ts create mode 100644 index.js create mode 100644 index.js.map create mode 100644 is.d.ts create mode 100644 is.js create mode 100644 is.js.map create mode 100644 isAmong.d.ts create mode 100644 isAmong.js create mode 100644 isAmong.js.map create mode 100644 isPromiseLike.d.ts create mode 100644 isPromiseLike.js create mode 100644 isPromiseLike.js.map create mode 100644 lab/PromiseOrNot.d.ts create mode 100644 lab/PromiseOrNot.js create mode 100644 lab/PromiseOrNot.js.map create mode 100644 lab/UnpackTypeGuard.d.ts create mode 100644 lab/UnpackTypeGuard.js create mode 100644 lab/UnpackTypeGuard.js.map create mode 100644 lab/defineAccessors.d.ts create mode 100644 lab/defineAccessors.js create mode 100644 lab/defineAccessors.js.map create mode 100644 lab/index.d.ts create mode 100644 lab/index.js create mode 100644 lab/index.js.map create mode 100644 lab/overwriteReadonlyProp.d.ts create mode 100644 lab/overwriteReadonlyProp.js create mode 100644 lab/overwriteReadonlyProp.js.map create mode 100644 lab/withDefaults.d.ts create mode 100644 lab/withDefaults.js create mode 100644 lab/withDefaults.js.map create mode 100644 noUndefined.d.ts create mode 100644 noUndefined.js create mode 100644 noUndefined.js.map create mode 100644 objectEntries.d.ts create mode 100644 objectEntries.js create mode 100644 objectEntries.js.map create mode 100644 objectFromEntries.d.ts create mode 100644 objectFromEntries.js create mode 100644 objectFromEntries.js.map create mode 100644 objectKeys.d.ts create mode 100644 objectKeys.js create mode 100644 objectKeys.js.map create mode 100644 symToStr.d.ts create mode 100644 symToStr.js create mode 100644 symToStr.js.map create mode 100644 tools/Object.fromEntries.d.ts create mode 100644 tools/Object.fromEntries.js create mode 100644 tools/Object.fromEntries.js.map create mode 100644 tools/StrictEquals.d.ts create mode 100644 tools/StrictEquals.js create mode 100644 tools/StrictEquals.js.map create mode 100644 tools/Unite.d.ts create mode 100644 tools/Unite.js create mode 100644 tools/Unite.js.map create mode 100644 tools/getProjectRoot.d.ts create mode 100644 tools/getProjectRoot.js create mode 100644 tools/getProjectRoot.js.map create mode 100644 tools/index.d.ts create mode 100644 tools/index.js create mode 100644 tools/index.js.map create mode 100644 tools/toUpperCase.d.ts create mode 100644 tools/toUpperCase.js create mode 100644 tools/toUpperCase.js.map create mode 100644 tsconfig.tsbuildinfo create mode 100644 typeGuard.d.ts create mode 100644 typeGuard.js create mode 100644 typeGuard.js.map create mode 100644 uncapitalize.d.ts create mode 100644 uncapitalize.js create mode 100644 uncapitalize.js.map create mode 100644 zz_internal/assertIsRefWrapper.d.ts create mode 100644 zz_internal/assertIsRefWrapper.js create mode 100644 zz_internal/assertIsRefWrapper.js.map diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml deleted file mode 100644 index 174e341..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.6.13 enable_short_npm_import_path - npx -y -p denoify@1.6.13 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..7a299e6 --- /dev/null +++ b/Equals.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// TODO: To export and document, this type can be used in place of equals if the types to compare have no `any` in them. +// (I think but some more testing is needed) +// export type LooseEquals = T extends U ? (U extends T ? true : false) : false; +//# 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..d71c79a --- /dev/null +++ b/Equals.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Equals.js","sourceRoot":"","sources":["src/Equals.ts"],"names":[],"mappings":";;AAQA,wHAAwH;AACxH,4CAA4C;AAC5C,sFAAsF"} \ 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..aee401b --- /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..c244d3b --- /dev/null +++ b/deno_dist/Equals.ts @@ -0,0 +1,11 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import type { Unite } from "./tools/Unite.ts"; +import type { StrictEquals } from "./tools/StrictEquals.ts"; + +// Credit https://stackoverflow.com/a/53808212/3731798 +/** https://docs.tsafe.dev/main/equals */ +export type Equals = StrictEquals, Unite>; + +// TODO: To export and document, this type can be used in place of equals if the types to compare have no `any` in them. +// (I think but some more testing is needed) +// export type LooseEquals = T extends U ? (U extends T ? true : false) : false; diff --git a/deno_dist/Extends.ts b/deno_dist/Extends.ts new file mode 100644 index 0000000..6425838 --- /dev/null +++ b/deno_dist/Extends.ts @@ -0,0 +1,24 @@ +/* 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..7116dd2 --- /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..7db4541 --- /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..f1dbb4d --- /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 (elemnt: U): elemnt is Exclude { + return test(elemnt); + }; +} 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..df8bc5a --- /dev/null +++ b/deno_dist/index.ts @@ -0,0 +1,26 @@ +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 * from "./isAmong.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/isAmong.ts b/deno_dist/isAmong.ts new file mode 100644 index 0000000..145c039 --- /dev/null +++ b/deno_dist/isAmong.ts @@ -0,0 +1,12 @@ +/** https://docs.tsafe.dev/isamong */ +export function isAmong( + names: readonly Name[], + value: unknown, +): value is Name { + for (const name of names) { + if (name === value) { + return true; + } + } + return false; +} diff --git a/deno_dist/isPromiseLike.ts b/deno_dist/isPromiseLike.ts new file mode 100644 index 0000000..78b0cb8 --- /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 === "object" && o !== null && "then" in o && typeof o.then === "function"; +} diff --git a/deno_dist/lab/PromiseOrNot.ts b/deno_dist/lab/PromiseOrNot.ts new file mode 100644 index 0000000..5ad9139 --- /dev/null +++ b/deno_dist/lab/PromiseOrNot.ts @@ -0,0 +1 @@ +export type PromiseOrNot = PromiseLike | T; diff --git a/deno_dist/lab/UnpackTypeGuard.ts b/deno_dist/lab/UnpackTypeGuard.ts new file mode 100644 index 0000000..d6e90ea --- /dev/null +++ b/deno_dist/lab/UnpackTypeGuard.ts @@ -0,0 +1,5 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +export type UnpackTypeGuard o is unknown> = T extends (o: any) => o is infer U + ? U + : never; diff --git a/deno_dist/lab/defineAccessors.ts b/deno_dist/lab/defineAccessors.ts new file mode 100644 index 0000000..7fc7aa7 --- /dev/null +++ b/deno_dist/lab/defineAccessors.ts @@ -0,0 +1,31 @@ +export const defineAccessors = , K extends keyof T>( + obj: T, + propertyName: K, + propertyDescriptor: { + get?: () => T[K]; + set?: (value: T[K]) => void; + }, +): void => { + const { get, set } = propertyDescriptor; + + Object.defineProperty(obj, propertyName, { + ...(Object.getOwnPropertyDescriptor(obj, propertyName) || { + "enumerable": true, + "configurable": true, + }), + ...(get !== undefined + ? { + "get": function () { + return get.call(this); + }, + } + : {}), + ...(set !== undefined + ? { + "set": function (value: T[K]) { + set.call(this, value); + }, + } + : {}), + }); +}; diff --git a/deno_dist/lab/index.ts b/deno_dist/lab/index.ts new file mode 100644 index 0000000..f44eb08 --- /dev/null +++ b/deno_dist/lab/index.ts @@ -0,0 +1,5 @@ +export * from "./defineAccessors.ts"; +export * from "./overwriteReadonlyProp.ts"; +export * from "./PromiseOrNot.ts"; +export * from "./UnpackTypeGuard.ts"; +export * from "./withDefaults.ts"; diff --git a/deno_dist/lab/overwriteReadonlyProp.ts b/deno_dist/lab/overwriteReadonlyProp.ts new file mode 100644 index 0000000..b684d12 --- /dev/null +++ b/deno_dist/lab/overwriteReadonlyProp.ts @@ -0,0 +1,52 @@ +/* eslint-disable no-empty */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import { assert } from "../assert.ts"; +import { is } from "../is.ts"; + +/** + * Assign a value to a property even if the object is freezed or if the property is not writable + * Throw if the assignation fail ( for example if the property is non configurable write: false ) + * */ +export const overwriteReadonlyProp = ( + obj: T, + propertyName: K, + value: T[K], +): T[K] => { + try { + obj[propertyName] = value; + } catch {} + + if (obj[propertyName] === value) { + return value; + } + + let errorDefineProperty: Error | undefined = undefined; + + const propertyDescriptor: PropertyDescriptor = Object.getOwnPropertyDescriptor( + obj, + propertyName, + ) || { + "enumerable": true, + "configurable": true, + }; + + if (!!propertyDescriptor.get) { + throw new Error(`Probably a wrong ides to overwrite ${String(propertyName)} getter`); + } + + try { + Object.defineProperty(obj, propertyName, { + ...propertyDescriptor, + value, + }); + } catch (error) { + assert(is(error)); + errorDefineProperty = error; + } + + if (obj[propertyName] !== value) { + throw errorDefineProperty || new Error("Can't assign"); + } + + return value; +}; diff --git a/deno_dist/lab/withDefaults.ts b/deno_dist/lab/withDefaults.ts new file mode 100644 index 0000000..00144e2 --- /dev/null +++ b/deno_dist/lab/withDefaults.ts @@ -0,0 +1,33 @@ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +import "../tools/Object.fromEntries.ts"; +/** + * Like Function.prototype.bind() but for a function that + * receives their parameters wrapped in an object. + * See documentation for more details: + * https://docs.tsafe.dev/withdefaults + */ +export function withDefaults, DefaultKey extends keyof Params, R>( + f: (params: Params) => R, + defaultParams: keyof Params extends never + ? Record + : { [Key in DefaultKey]: Params[Key] }, +): ( + params: { [Key in keyof Omit]: Params[Key] } & { + defaultsOverwrite?: { [Key in DefaultKey]?: [Params[Key]] }; + }, +) => R { + return params => { + const { defaultsOverwrite = {}, ...actualParams } = params; + + return f({ + ...defaultParams, + ...actualParams, + ...Object.fromEntries( + Object.entries(defaultsOverwrite) + .filter(([, value]) => value !== undefined) + .map(([key, value]) => [key, (value as any)[0]]), + ), + } as any); + }; +} diff --git a/deno_dist/mod.ts b/deno_dist/mod.ts new file mode 100644 index 0000000..da5ee32 --- /dev/null +++ b/deno_dist/mod.ts @@ -0,0 +1 @@ +export * from "./index.ts"; \ No newline at end of file diff --git a/deno_dist/noUndefined.ts b/deno_dist/noUndefined.ts new file mode 100644 index 0000000..d2d1012 --- /dev/null +++ b/deno_dist/noUndefined.ts @@ -0,0 +1,24 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/ban-types */ + +/** + * Removes the enumerable properties whose values are + * undefined. + * + * Example: + * noUndefined({ "foo": undefined, "bar": 3 }) returns + * a new object { "bar": 3 } + */ +export function noUndefined(obj: T): T { + const out: typeof obj = {} as any; + + for (const key in obj) { + if (obj[key] === undefined) { + continue; + } + + out[key] = obj[key]; + } + + return out; +} diff --git a/deno_dist/objectEntries.ts b/deno_dist/objectEntries.ts new file mode 100644 index 0000000..681211d --- /dev/null +++ b/deno_dist/objectEntries.ts @@ -0,0 +1,14 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +/** https://docs.tsafe.dev/objectentries */ +export function objectEntries>( + o: O, +): Exclude<{ [Key in keyof O]: [Key, O[Key]] }[keyof O], undefined>[] { + return Object.entries(o) as any; +} + +/** Return type of objectEntries https://docs.tsafe.dev/objectentries */ +export type ObjectEntries> = Exclude< + { [Key in keyof O]: [Key, O[Key]] }[keyof O], + undefined +>[]; diff --git a/deno_dist/objectFromEntries.ts b/deno_dist/objectFromEntries.ts new file mode 100644 index 0000000..8c060a0 --- /dev/null +++ b/deno_dist/objectFromEntries.ts @@ -0,0 +1,13 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +/** https://docs.tsafe.dev/objectFromEntries */ +export function objectFromEntries( + entries: readonly Entry[], +): { [Key in Entry[0]]: Extract[1] } { + return Object.fromEntries(entries) as any; +} + +/** Return type of objectFromEntries https://docs.tsafe.dev/objectFromEntries */ +export type ObjectFromEntries = { + [Key in Entry[0]]: Extract[1]; +}; diff --git a/deno_dist/objectKeys.ts b/deno_dist/objectKeys.ts new file mode 100644 index 0000000..f732807 --- /dev/null +++ b/deno_dist/objectKeys.ts @@ -0,0 +1,6 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +/** https://docs.tsafe.dev/objectKeys */ +export function objectKeys>(o: T): (keyof T)[] { + return Object.keys(o) as any; +} diff --git a/deno_dist/symToStr.ts b/deno_dist/symToStr.ts new file mode 100644 index 0000000..46219fe --- /dev/null +++ b/deno_dist/symToStr.ts @@ -0,0 +1,5 @@ +/** @see */ +export function symToStr>(wrap: T): Exclude { + // @ts-expect-error: We know better + return Object.keys(wrap)[0]; +} diff --git a/deno_dist/tools/Object.fromEntries.ts b/deno_dist/tools/Object.fromEntries.ts new file mode 100644 index 0000000..dd31775 --- /dev/null +++ b/deno_dist/tools/Object.fromEntries.ts @@ -0,0 +1,23 @@ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +if (!(Object as any).fromEntries) { + Object.defineProperty(Object, "fromEntries", { + "value": function (entries: any) { + if (!entries || !entries[Symbol.iterator]) { + throw new Error("Object.fromEntries() requires a single iterable argument"); + } + + const o: any = {}; + + Object.keys(entries).forEach(key => { + const [k, v] = entries[key]; + + o[k] = v; + }); + + return o; + }, + }); +} + +export {}; diff --git a/deno_dist/tools/StrictEquals.ts b/deno_dist/tools/StrictEquals.ts new file mode 100644 index 0000000..73a5f76 --- /dev/null +++ b/deno_dist/tools/StrictEquals.ts @@ -0,0 +1,2 @@ +export type StrictEquals = + (() => A extends A2 ? true : false) extends () => A extends A1 ? true : false ? true : false; diff --git a/deno_dist/tools/Unite.ts b/deno_dist/tools/Unite.ts new file mode 100644 index 0000000..fc3014e --- /dev/null +++ b/deno_dist/tools/Unite.ts @@ -0,0 +1 @@ +export type Unite = T extends Record ? { [Key in keyof T]: T[Key] } : T; diff --git a/deno_dist/tools/getProjectRoot.ts b/deno_dist/tools/getProjectRoot.ts new file mode 100644 index 0000000..6981ef2 --- /dev/null +++ b/deno_dist/tools/getProjectRoot.ts @@ -0,0 +1,45 @@ +const __dirname = (() => { + const { url: urlStr } = import.meta; + const url = new URL(urlStr); + const __filename = (url.protocol === "file:" ? url.pathname : urlStr) + .replace(/[/][^/]*$/, ''); + + const isWindows = (() => { + + let NATIVE_OS: typeof Deno.build.os = "linux"; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const navigator = (globalThis as any).navigator; + if (globalThis.Deno != null) { + NATIVE_OS = Deno.build.os; + } else if (navigator?.appVersion?.includes?.("Win") ?? false) { + NATIVE_OS = "windows"; + } + + return NATIVE_OS == "windows"; + + })(); + + return isWindows ? + __filename.split("/").join("\\").substring(1) : + __filename; +})(); + +import * as fs from "node:fs"; +import * as path from "node:path"; + +function getProjectRootRec(dirPath: string): string { + if (fs.existsSync(path.join(dirPath, "package.json"))) { + return dirPath; + } + return getProjectRootRec(path.join(dirPath, "..")); +} + +let result: string | undefined = undefined; + +export function getProjectRoot(): string { + if (result !== undefined) { + return result; + } + + return (result = getProjectRootRec(__dirname)); +} diff --git a/deno_dist/tools/index.ts b/deno_dist/tools/index.ts new file mode 100644 index 0000000..0983ef0 --- /dev/null +++ b/deno_dist/tools/index.ts @@ -0,0 +1,5 @@ +export * from "./getProjectRoot.ts"; +export * from "./Object.fromEntries.ts"; +export * from "./StrictEquals.ts"; +export * from "./toUpperCase.ts"; +export * from "./Unite.ts"; diff --git a/deno_dist/tools/toUpperCase.ts b/deno_dist/tools/toUpperCase.ts new file mode 100644 index 0000000..a4d5672 --- /dev/null +++ b/deno_dist/tools/toUpperCase.ts @@ -0,0 +1,3 @@ +export function toUpperCase(str: string): string { + return str.toUpperCase(); +} diff --git a/deno_dist/typeGuard.ts b/deno_dist/typeGuard.ts new file mode 100644 index 0000000..4e17714 --- /dev/null +++ b/deno_dist/typeGuard.ts @@ -0,0 +1,7 @@ +/* eslint-disable @typescript-eslint/no-namespace */ +/* eslint-disable @typescript-eslint/no-explicit-any */ + +/** https://docs.tsafe.dev/typeguard */ +export function typeGuard(_value: any, isMatched: boolean): _value is T { + return isMatched; +} diff --git a/deno_dist/uncapitalize.ts b/deno_dist/uncapitalize.ts new file mode 100644 index 0000000..af14275 --- /dev/null +++ b/deno_dist/uncapitalize.ts @@ -0,0 +1,5 @@ +/** @see */ +export function uncapitalize(str: S): Uncapitalize { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (str.charAt(0).toLowerCase() + str.slice(1)) as any; +} diff --git a/deno_dist/zz_internal/assertIsRefWrapper.ts b/deno_dist/zz_internal/assertIsRefWrapper.ts new file mode 100644 index 0000000..39553fc --- /dev/null +++ b/deno_dist/zz_internal/assertIsRefWrapper.ts @@ -0,0 +1,5 @@ +import { id } from "../id.ts"; + +export const assertIsRefWrapper = { + "ref": id>(undefined), +}; diff --git a/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..afad9ea --- /dev/null +++ b/esm/Equals.mjs @@ -0,0 +1,5 @@ +export {}; +// TODO: To export and document, this type can be used in place of equals if the types to compare have no `any` in them. +// (I think but some more testing is needed) +// export type LooseEquals = T extends U ? (U extends T ? true : false) : false; +//# 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..725dd32 --- /dev/null +++ b/esm/Equals.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"Equals.mjs","sourceRoot":"","sources":["../src/Equals.ts"],"names":[],"mappings":";AAQA,wHAAwH;AACxH,4CAA4C;AAC5C,sFAAsF"} \ 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..aee401b --- /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..2f385d5 --- /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): (elemnt: U) => elemnt is Exclude; diff --git a/esm/exclude.mjs b/esm/exclude.mjs new file mode 100644 index 0000000..7d023e1 --- /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 (elemnt) { + return test(elemnt); + }; +} +//# 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..e2fd8d3 --- /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,MAAS;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;IACxB,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..2b17e18 --- /dev/null +++ b/esm/index.d.ts @@ -0,0 +1,26 @@ +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 * from "./isAmong.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..b1ebea2 --- /dev/null +++ b/esm/index.mjs @@ -0,0 +1,16 @@ +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 "./isAmong.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..7116cdc --- /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;AACrB,cAAc,WAAW,CAAC;AAK1B,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/isAmong.d.ts b/esm/isAmong.d.ts new file mode 100644 index 0000000..9e7618a --- /dev/null +++ b/esm/isAmong.d.ts @@ -0,0 +1,2 @@ +/** https://docs.tsafe.dev/isamong */ +export declare function isAmong(names: readonly Name[], value: unknown): value is Name; diff --git a/esm/isAmong.mjs b/esm/isAmong.mjs new file mode 100644 index 0000000..8810e3d --- /dev/null +++ b/esm/isAmong.mjs @@ -0,0 +1,32 @@ +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."); +}; +/** https://docs.tsafe.dev/isamong */ +export function isAmong(names, value) { + var e_1, _a; + try { + for (var names_1 = __values(names), names_1_1 = names_1.next(); !names_1_1.done; names_1_1 = names_1.next()) { + var name_1 = names_1_1.value; + if (name_1 === value) { + return true; + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + 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 false; +} +//# sourceMappingURL=isAmong.mjs.map \ No newline at end of file diff --git a/esm/isAmong.mjs.map b/esm/isAmong.mjs.map new file mode 100644 index 0000000..88d96e7 --- /dev/null +++ b/esm/isAmong.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"isAmong.mjs","sourceRoot":"","sources":["../src/isAmong.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,qCAAqC;AACrC,MAAM,UAAU,OAAO,CACnB,KAAsB,EACtB,KAAc;;;QAEd,KAAmB,IAAA,UAAA,SAAA,KAAK,CAAA,4BAAA,+CAAE;YAArB,IAAM,MAAI,kBAAA;YACX,IAAI,MAAI,KAAK,KAAK,EAAE;gBAChB,OAAO,IAAI,CAAC;aACf;SACJ;;;;;;;;;IACD,OAAO,KAAK,CAAC;AACjB,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..75bfd59 --- /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 === "object" && o !== null && "then" in o && typeof 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..ee70fd3 --- /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,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,MAAM,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC;AAC9F,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/index.d.ts b/esm/lab/index.d.ts new file mode 100644 index 0000000..6b4fc3e --- /dev/null +++ b/esm/lab/index.d.ts @@ -0,0 +1,5 @@ +export * from "./defineAccessors.mjs"; +export * from "./overwriteReadonlyProp.mjs"; +export * from "./PromiseOrNot.mjs"; +export * from "./UnpackTypeGuard.mjs"; +export * from "./withDefaults.mjs"; diff --git a/esm/lab/index.mjs b/esm/lab/index.mjs new file mode 100644 index 0000000..8125c85 --- /dev/null +++ b/esm/lab/index.mjs @@ -0,0 +1,6 @@ +export * from "./defineAccessors.mjs"; +export * from "./overwriteReadonlyProp.mjs"; +export * from "./PromiseOrNot.mjs"; +export * from "./UnpackTypeGuard.mjs"; +export * from "./withDefaults.mjs"; +//# sourceMappingURL=index.mjs.map \ No newline at end of file diff --git a/esm/lab/index.mjs.map b/esm/lab/index.mjs.map new file mode 100644 index 0000000..2532e44 --- /dev/null +++ b/esm/lab/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/lab/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,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..2857462 --- /dev/null +++ b/esm/symToStr.d.ts @@ -0,0 +1,2 @@ +/** @see */ +export declare function symToStr>(wrap: T): Exclude; diff --git a/esm/symToStr.mjs b/esm/symToStr.mjs new file mode 100644 index 0000000..9b37681 --- /dev/null +++ b/esm/symToStr.mjs @@ -0,0 +1,6 @@ +/** @see */ +export function symToStr(wrap) { + // @ts-expect-error: We know better + 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..f5e89bf --- /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,mCAAmC;IACnC,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/index.d.ts b/esm/tools/index.d.ts new file mode 100644 index 0000000..857f730 --- /dev/null +++ b/esm/tools/index.d.ts @@ -0,0 +1,5 @@ +export * from "./getProjectRoot.mjs"; +export * from "./Object.fromEntries.mjs"; +export * from "./StrictEquals.mjs"; +export * from "./toUpperCase.mjs"; +export * from "./Unite.mjs"; diff --git a/esm/tools/index.mjs b/esm/tools/index.mjs new file mode 100644 index 0000000..42ba592 --- /dev/null +++ b/esm/tools/index.mjs @@ -0,0 +1,6 @@ +export * from "./getProjectRoot.mjs"; +export * from "./Object.fromEntries.mjs"; +export * from "./StrictEquals.mjs"; +export * from "./toUpperCase.mjs"; +export * from "./Unite.mjs"; +//# sourceMappingURL=index.mjs.map \ No newline at end of file diff --git a/esm/tools/index.mjs.map b/esm/tools/index.mjs.map new file mode 100644 index 0000000..ac6ed3b --- /dev/null +++ b/esm/tools/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,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..abbfcbb --- /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","../../node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../src/tools/Unite.ts","../../src/tools/StrictEquals.ts","../../src/Equals.ts","../../src/Extends.ts","../../src/MethodNames.ts","../../src/Not.ts","../../src/Parameters.ts","../../src/Param0.ts","../../src/PickOptionals.ts","../../src/PickRequired.ts","../../src/Reflect.ts","../../src/ReturnType.ts","../../src/UnionToIntersection.ts","../../src/UnpackPromise.ts","../../src/id.ts","../../src/zz_internal/assertIsRefWrapper.ts","../../src/is.ts","../../src/lab/overwriteReadonlyProp.ts","../../src/assert.ts","../../src/capitalize.ts","../../src/exclude.ts","../../src/flip.ts","../../src/isPromiseLike.ts","../../src/objectKeys.ts","../../src/typeGuard.ts","../../src/isAmong.ts","../../src/objectEntries.ts","../../src/objectFromEntries.ts","../../src/noUndefined.ts","../../src/uncapitalize.ts","../../src/index.ts","../../src/symToStr.ts","../../src/lab/PromiseOrNot.ts","../../src/lab/UnpackTypeGuard.ts","../../src/lab/defineAccessors.ts","../../src/tools/Object.fromEntries.ts","../../src/lab/withDefaults.ts","../../src/lab/index.ts","../../src/tools/getProjectRoot.ts","../../src/tools/toUpperCase.ts","../../src/tools/index.ts","../../node_modules/@types/comment-json/index.d.ts","../../node_modules/@types/json-schema/index.d.ts","../../node_modules/@types/node/assert.d.ts","../../node_modules/@types/node/assert/strict.d.ts","../../node_modules/@types/node/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":"6a6b471e7e43e15ef6f8fe617a22ce4ecb0e34efa6c3dfcfe7cebd392bcca9d2","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","dc48272d7c333ccf58034c0026162576b7d50ea0e69c3b9292f803fc20720fd5","27147504487dc1159369da4f4da8a26406364624fa9bc3db632f7d94a5bae2c3","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4",{"version":"fcd3ecc9f764f06f4d5c467677f4f117f6abf49dee6716283aa204ff1162498b","affectsGlobalScope":true},{"version":"f296963760430fb65b4e5d91f0ed770a91c6e77455bacf8fa23a1501654ede0e","affectsGlobalScope":true},{"version":"5114a95689b63f96b957e00216bc04baf9e1a1782aa4d8ee7e5e9acbf768e301","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"ab22100fdd0d24cfc2cc59d0a00fc8cf449830d9c4030dc54390a46bd562e929","affectsGlobalScope":true},{"version":"f7bd636ae3a4623c503359ada74510c4005df5b36de7f23e1db8a5c543fd176b","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"0c20f4d2358eb679e4ae8a4432bdd96c857a2960fd6800b21ec4008ec59d60ea","affectsGlobalScope":true},{"version":"36ae84ccc0633f7c0787bc6108386c8b773e95d3b052d9464a99cd9b8795fbec","affectsGlobalScope":true},{"version":"82d0d8e269b9eeac02c3bd1c9e884e85d483fcb2cd168bccd6bc54df663da031","affectsGlobalScope":true},{"version":"b8deab98702588840be73d67f02412a2d45a417a3c097b2e96f7f3a42ac483d1","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"376d554d042fb409cb55b5cbaf0b2b4b7e669619493c5d18d5fa8bd67273f82a","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"c4138a3dd7cd6cf1f363ca0f905554e8d81b45844feea17786cdf1626cb8ea06","affectsGlobalScope":true},{"version":"6ff3e2452b055d8f0ec026511c6582b55d935675af67cdb67dd1dc671e8065df","affectsGlobalScope":true},{"version":"03de17b810f426a2f47396b0b99b53a82c1b60e9cba7a7edda47f9bb077882f4","affectsGlobalScope":true},{"version":"8184c6ddf48f0c98429326b428478ecc6143c27f79b79e85740f17e6feb090f1","affectsGlobalScope":true},{"version":"261c4d2cf86ac5a89ad3fb3fafed74cbb6f2f7c1d139b0540933df567d64a6ca","affectsGlobalScope":true},{"version":"6af1425e9973f4924fca986636ac19a0cf9909a7e0d9d3009c349e6244e957b6","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"15a630d6817718a2ddd7088c4f83e4673fde19fa992d2eae2cf51132a302a5d3","affectsGlobalScope":true},{"version":"b7e9f95a7387e3f66be0ed6db43600c49cec33a3900437ce2fd350d9b7cb16f2","affectsGlobalScope":true},{"version":"01e0ee7e1f661acedb08b51f8a9b7d7f959e9cdb6441360f06522cc3aea1bf2e","affectsGlobalScope":true},{"version":"ac17a97f816d53d9dd79b0d235e1c0ed54a8cc6a0677e9a3d61efb480b2a3e4e","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"9cc66b0513ad41cb5f5372cca86ef83a0d37d1c1017580b7dace3ea5661836df","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"307c8b7ebbd7f23a92b73a4c6c0a697beca05b06b036c23a34553e5fe65e4fdc","affectsGlobalScope":true},{"version":"189c0703923150aa30673fa3de411346d727cc44a11c75d05d7cf9ef095daa22","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},{"version":"f6b19500d5de61452d537a4a495cfae224ff97de8b2afa9b156a14e261d9dc45","signature":"2ac80842d9cafe9e128a13bd4a26813cc5902ececc48de01367f38b52798bf8f"},{"version":"dfcc960e925b12f997798b18975d16d82ca2138907ce163832ea4f753a6026b1","signature":"18b1d10d73315c68e4a35eb2b70a662fa89f8c3a1287180f69415e80f9d4feb9"},{"version":"7fe53ba37b1a4c2d717d605b71497c3089b89802cfd30dbb192be468ae79ec10","signature":"72f1c4c1b9fb45abab255f752dd46cbd01c9126888e2a0cf2db27bc89b6987cb"},{"version":"ba1996d8fc4240710af1a9aae1f15574ee0b2bea3d934e5c54daa928e83ac252","signature":"9cb1cea28e8a631fc4a2ab73c83c0696baab7249b2cfadfd43ffca5e441abb35"},{"version":"a98f362ec9d130a8fee0ebe21a7ea2fcaef9fe9c8d49e228099a6e5bb1dc75b6","signature":"662db21955325cafe247411736fb00e6493204370917f70b67e4b5f3b93c3179"},"02da4f252835cd9cdc1049dc4f27a336f44fc3fb2b587e340d03de45a48830e4",{"version":"ed39a06fcdec4146b81408cbeccb66829034033a05221ea6892177709c472abc","signature":"260a8544fe628efaed6408401910135295ff450af5c8ab76822db61e63ac6a32"},{"version":"eae9988326fd64a1d1ba354e9cbcc2b889909cb50831087e2cc0e8316f02fe33","signature":"e896f32b7424fcc47a39ffaa580e2555f19da3129ad97e19825096e821a92d13"},{"version":"be2476a98a660ac0c6b14cb1bd09285f5d21e0fe5ba12b25adc2443db93421ce","signature":"00f6cb5af8f9ca81ad3e668aa743465587f0a609d3a7fbd113eefd561e6a137b"},{"version":"454fa710bcf4ac32638e96b0c467e1344165c927d221733aa2e77037b3539078","signature":"ce53f0cc7de2c5945e8828cc7651820a2ebdf90503a54de2bcf75f169ad2ad29"},{"version":"aa2712d356ed12a0c72a7f154d0160ecab56f06da86c21540b2645c90f7248d7","signature":"85d2371b2f96b2dd6ec7aa5f2d5099d5d10a4b4c614914f2b531872f7bdb037a"},{"version":"ea83c0ddd554616cfbede4b11b59910f4fc93f8c8001dea25f7837f74fcf3cc7","signature":"1eef420ff81e5840050097a0f15ab7858dca15aff0a2e9c7082c332c6fcef7ec"},{"version":"ea630c2dc976ca3572cf3f1b064ba070f15ad5b67328a1b3e73fbda1dabdc9e4","signature":"f54c9e9d1692e868be8e5da3638a5e38f5d2d1324de7752170d1ab4160d1cc67"},{"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":"9c31e283f7cc8ece5d2728d32e1238498dcb5c28077a3a8f1f7e6dc4bc660521","signature":"a3c85548cae6bf2bd7c45f23c38509038315d10f0400919102bff397112ef25a"},{"version":"cfa42eee23927d15b60d467db75d4c9c48b1d08b3d6511e6386ff77e42f0ee40","signature":"74b94d41129afb2f4ef6dae6669cc52f6352b83d11704e0143bbccbc483c2094"},{"version":"7359a7bd156fb7263f17b59477e22e61c26d646d27f7df3a70a408a43033a2f3","signature":"18f455507ad251d2e04fa76dc6e2a7ccb090329c092913fca6197c5fef5d19eb"},{"version":"2d04d4da6d9c7afae2559a9598ccebb3d1d4fd6b0b420cf7ca8f3c9f20c9a858","signature":"0074b2c395fdd7241199a53b6b5a04c56af5a56366c9108491ea3a07676f364b"},{"version":"8012ea9591da5ff83fa43d1a42c9911736b0f841726bc88a07deb53ae717f41b","signature":"5bb1f84b59523bb590af00c91dbe1d0d13502d8f5d69d20a1f44859fdc1f23b3"},{"version":"d78d41cc68cf3bdcd698165757b0ba5288d8bf4eb409cfd498365ec1557e3eaf","signature":"295d63f0ad3f577a40cbb630ce667e274908c814a2703fc13d103122b8215e9f"},{"version":"2bb83825af7e1950c04621e4d055814333d2cca24eb3aab95918ce95212a3561","signature":"82aeba550610395d2914fd6d1a4606d02b95a2a8b250a52ec303db71590b41b3"},{"version":"b0e20c5407a5e79d50bb90a9b445f4889c7ef562438db770b395515170e9b5e9","signature":"14aff5197faa1b13369c3d455556e61f3f1bd0cd856a9fddefc37714d5fddab5"},{"version":"112299f77f951fe6b8eb50821334f6aebcf574b5b7d89e2431b91fe1df55c7ab","signature":"4dde3a0c022816a842ebcaf7375b5e696736efd4836280377ec0aa0107879e4d"},{"version":"60cde8c6e76aa07d8f942c384b532ca01c14bcfde49561a6b17f95f9641d2dd8","signature":"05232bf12123918b55128f74d7534831fea94983e8766b0cd8e9b2247e70217b"},"d85b5e32ca34d125815d0e875f6839d73215768c90b7482fddd610eef622e168",{"version":"cc21a3b21e2f8f35dd8f90d28b6060a6c7bd1a72b99a77ec0556b519a7a73934","signature":"a8040c10d140be3f94f7bc993b29f8f7e34f56b5042b580ed8ca7a984fe95627"},"ab46309b639fb01d162488e25afc36bf4a8da3ab37f09a6dc70c733a5b9829ba",{"version":"2f43d2ff5bc86c1612b2b8cc88095688d51107539a77c67a7d132814d482c06c","signature":"a14188d445479722060109930b6f38281cf57d2b370b6f3c4d89442504f3bed7"},{"version":"94e8eae7586e7b256cb3a0e266a0fb71d5307c542243963fad5f52c91ac40aa8","signature":"0ad7a2b067566d9ece83849e37f792792be0632809ccd3dc7eb0f44f82d40bd0"},{"version":"e260d3a5275e3b54fa5373f48ea39b3b4c876bbecfa09b0dc19d5dce2d311a2e","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"62e1bf47389b38255f5b77d5548e6983ee192a1bb2254bcd6c0333fc2ef13c34","signature":"da51336066b98b8b26a64d60f4185a10a801c71dc02c9065f8f90127e8813ce0"},"4d2aefa43e03d5a32d161ab91ed6c34a83c31573d107f6c2f503269552760727",{"version":"3e6239b7b45d4c78f745b459e3a8493af4be6a5fc078cbc6c471d5db77902a06","signature":"200426c8d87ae866a7eb0e9ce577ebd7b9437df0f4d166965840e01e96144eff"},{"version":"0f2ac3e73064d6a8ec7f3ef8c726ecc9bd2cc34045cf18b2ec8142790d75bbe7","signature":"55216b3caf3325c8aa65aab47b84e826fca2bb492e229733d5599cc2ba4958fe"},"efbcd0db768c8811b991e8b20165035182beb666381ff1db7044b4119aba5ee3","c401118ea6c6daa9f196013b0622c602d4faec565bb1cc6ca751d2a8fc295498","0359682c54e487c4cab2b53b2b4d35cc8dea4d9914bc6abcdb5701f8b8e745a4","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"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"],"root":[[45,85]],"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":[[135],[88,135],[92,135],[93,98,126,135],[94,104,106,113,123,134,135],[94,95,104,113,135],[96,135],[97,98,106,114,135],[98,123,131,135],[99,101,104,113,135],[100,135],[101,102,135],[104,135],[103,104,135],[104,106,107,123,134,135],[104,106,107,120,123,126,135],[90,135],[101,108,113,123,134,135],[104,106,108,109,113,123,131,134,135],[108,110,123,131,134,135],[88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140],[104,111,135],[112,134,135],[101,104,113,123,135],[114,135],[115,135],[92,116,135],[90,117,133,135],[118,135],[119,135],[104,120,121,135],[120,122,135,137],[93,104,123,124,125,126,135],[93,123,125,135],[123,124,135],[126,135],[127,135],[104,129,130,135],[129,130,135],[98,113,123,131,135],[132,135],[113,133,135],[93,108,119,134,135],[98,135],[123,135,136],[135,137],[135,138],[90,93,98,104,107,116,123,134,135,137],[123,135,139],[45,46,135],[46,135],[51,135],[53,135],[47,60,62,135],[47,48,49,50,51,52,53,54,55,56,57,58,59,61,63,64,65,66,67,68,69,70,71,72,73,74,135],[60,135],[62,77,78,79,81,135],[61,63,135],[80,135],[106,115,135],[45,46,80,83,84,135],[59,135],[45,46],[46],[51],[53],[47],[80]],"referencedMap":[[86,1],[87,1],[88,2],[89,2],[92,3],[93,4],[94,5],[95,6],[96,7],[97,8],[98,9],[99,10],[100,11],[101,12],[102,12],[105,13],[103,14],[104,13],[106,15],[107,16],[91,17],[140,1],[108,18],[109,19],[110,20],[141,21],[111,22],[112,23],[113,24],[114,25],[115,26],[116,27],[117,28],[118,29],[119,30],[120,31],[121,31],[122,32],[123,33],[125,34],[124,35],[126,36],[127,37],[128,1],[129,38],[130,39],[131,40],[132,41],[133,42],[134,43],[135,44],[136,45],[137,46],[138,47],[90,48],[139,49],[142,1],[43,1],[44,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[33,1],[30,1],[31,1],[32,1],[34,1],[7,1],[35,1],[40,1],[41,1],[36,1],[37,1],[38,1],[39,1],[1,1],[42,1],[47,50],[48,51],[49,1],[50,1],[52,52],[51,1],[53,1],[54,53],[55,1],[56,1],[57,1],[58,1],[63,54],[64,1],[65,1],[66,1],[59,1],[75,55],[61,56],[70,1],[67,1],[77,1],[78,1],[79,1],[82,57],[62,58],[81,59],[73,1],[71,1],[72,1],[68,1],[76,1],[80,1],[46,1],[45,1],[83,60],[85,61],[84,1],[69,1],[74,1],[60,62]],"exportedModulesMap":[[86,1],[87,1],[88,2],[89,2],[92,3],[93,4],[94,5],[95,6],[96,7],[97,8],[98,9],[99,10],[100,11],[101,12],[102,12],[105,13],[103,14],[104,13],[106,15],[107,16],[91,17],[140,1],[108,18],[109,19],[110,20],[141,21],[111,22],[112,23],[113,24],[114,25],[115,26],[116,27],[117,28],[118,29],[119,30],[120,31],[121,31],[122,32],[123,33],[125,34],[124,35],[126,36],[127,37],[128,1],[129,38],[130,39],[131,40],[132,41],[133,42],[134,43],[135,44],[136,45],[137,46],[138,47],[90,48],[139,49],[142,1],[43,1],[44,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[33,1],[30,1],[31,1],[32,1],[34,1],[7,1],[35,1],[40,1],[41,1],[36,1],[37,1],[38,1],[39,1],[1,1],[42,1],[47,63],[48,64],[50,1],[52,65],[54,66],[63,67],[75,55],[77,1],[82,57],[81,68],[85,61]],"semanticDiagnosticsPerFile":[86,87,88,89,92,93,94,95,96,97,98,99,100,101,102,105,103,104,106,107,91,140,108,109,110,141,111,112,113,114,115,116,117,118,119,120,121,122,123,125,124,126,127,128,129,130,131,132,133,134,135,136,137,138,90,139,142,43,44,8,10,9,2,11,12,13,14,15,16,17,18,3,4,22,19,20,21,23,24,25,5,26,27,28,29,6,33,30,31,32,34,7,35,40,41,36,37,38,39,1,42,47,48,49,50,52,51,53,54,55,56,57,58,63,64,65,66,59,75,61,70,67,77,78,79,82,62,81,73,71,72,68,76,80,46,45,83,85,84,69,74,60]},"version":"5.0.4"} \ 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..2f385d5 --- /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): (elemnt: U) => elemnt is Exclude; diff --git a/exclude.js b/exclude.js new file mode 100644 index 0000000..4508999 --- /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 (elemnt) { + return test(elemnt); + }; +} +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..6a57dd5 --- /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,MAAS;QACzB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;IACxB,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..8bb1f46 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,26 @@ +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 * from "./isAmong"; +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..5c81ad5 --- /dev/null +++ b/index.js @@ -0,0 +1,32 @@ +"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("./isAmong"), 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..5eecc63 --- /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;AACrB,4CAA0B;AAK1B,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/isAmong.d.ts b/isAmong.d.ts new file mode 100644 index 0000000..9e7618a --- /dev/null +++ b/isAmong.d.ts @@ -0,0 +1,2 @@ +/** https://docs.tsafe.dev/isamong */ +export declare function isAmong(names: readonly Name[], value: unknown): value is Name; diff --git a/isAmong.js b/isAmong.js new file mode 100644 index 0000000..9b01f1e --- /dev/null +++ b/isAmong.js @@ -0,0 +1,36 @@ +"use strict"; +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 }); +exports.isAmong = void 0; +/** https://docs.tsafe.dev/isamong */ +function isAmong(names, value) { + var e_1, _a; + try { + for (var names_1 = __values(names), names_1_1 = names_1.next(); !names_1_1.done; names_1_1 = names_1.next()) { + var name_1 = names_1_1.value; + if (name_1 === value) { + return true; + } + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + 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 false; +} +exports.isAmong = isAmong; +//# sourceMappingURL=isAmong.js.map \ No newline at end of file diff --git a/isAmong.js.map b/isAmong.js.map new file mode 100644 index 0000000..65c961a --- /dev/null +++ b/isAmong.js.map @@ -0,0 +1 @@ +{"version":3,"file":"isAmong.js","sourceRoot":"","sources":["src/isAmong.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qCAAqC;AACrC,SAAgB,OAAO,CACnB,KAAsB,EACtB,KAAc;;;QAEd,KAAmB,IAAA,UAAA,SAAA,KAAK,CAAA,4BAAA,+CAAE;YAArB,IAAM,MAAI,kBAAA;YACX,IAAI,MAAI,KAAK,KAAK,EAAE;gBAChB,OAAO,IAAI,CAAC;aACf;SACJ;;;;;;;;;IACD,OAAO,KAAK,CAAC;AACjB,CAAC;AAVD,0BAUC"} \ 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..bc75945 --- /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 === "object" && o !== null && "then" in o && typeof 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..34591dc --- /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,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,MAAM,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC;AAC9F,CAAC;AAFD,sCAEC"} \ No newline at end of file diff --git a/lab/PromiseOrNot.d.ts b/lab/PromiseOrNot.d.ts new file mode 100644 index 0000000..5ad9139 --- /dev/null +++ b/lab/PromiseOrNot.d.ts @@ -0,0 +1 @@ +export type PromiseOrNot = PromiseLike | T; diff --git a/lab/PromiseOrNot.js b/lab/PromiseOrNot.js new file mode 100644 index 0000000..206c5b9 --- /dev/null +++ b/lab/PromiseOrNot.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=PromiseOrNot.js.map \ No newline at end of file diff --git a/lab/PromiseOrNot.js.map b/lab/PromiseOrNot.js.map new file mode 100644 index 0000000..e203d42 --- /dev/null +++ b/lab/PromiseOrNot.js.map @@ -0,0 +1 @@ +{"version":3,"file":"PromiseOrNot.js","sourceRoot":"","sources":["../src/lab/PromiseOrNot.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/lab/UnpackTypeGuard.d.ts b/lab/UnpackTypeGuard.d.ts new file mode 100644 index 0000000..af4fc37 --- /dev/null +++ b/lab/UnpackTypeGuard.d.ts @@ -0,0 +1 @@ +export type UnpackTypeGuard o is unknown> = T extends (o: any) => o is infer U ? U : never; diff --git a/lab/UnpackTypeGuard.js b/lab/UnpackTypeGuard.js new file mode 100644 index 0000000..d72952f --- /dev/null +++ b/lab/UnpackTypeGuard.js @@ -0,0 +1,4 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=UnpackTypeGuard.js.map \ No newline at end of file diff --git a/lab/UnpackTypeGuard.js.map b/lab/UnpackTypeGuard.js.map new file mode 100644 index 0000000..314c53e --- /dev/null +++ b/lab/UnpackTypeGuard.js.map @@ -0,0 +1 @@ +{"version":3,"file":"UnpackTypeGuard.js","sourceRoot":"","sources":["../src/lab/UnpackTypeGuard.ts"],"names":[],"mappings":";AAAA,uDAAuD"} \ No newline at end of file diff --git a/lab/defineAccessors.d.ts b/lab/defineAccessors.d.ts new file mode 100644 index 0000000..0b07e45 --- /dev/null +++ b/lab/defineAccessors.d.ts @@ -0,0 +1,4 @@ +export declare const defineAccessors: , K extends keyof T>(obj: T, propertyName: K, propertyDescriptor: { + get?: (() => T[K]) | undefined; + set?: ((value: T[K]) => void) | undefined; +}) => void; diff --git a/lab/defineAccessors.js b/lab/defineAccessors.js new file mode 100644 index 0000000..10a67d8 --- /dev/null +++ b/lab/defineAccessors.js @@ -0,0 +1,35 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.defineAccessors = void 0; +var defineAccessors = function (obj, propertyName, propertyDescriptor) { + var get = propertyDescriptor.get, set = propertyDescriptor.set; + Object.defineProperty(obj, propertyName, __assign(__assign(__assign({}, (Object.getOwnPropertyDescriptor(obj, propertyName) || { + "enumerable": true, + "configurable": true, + })), (get !== undefined + ? { + "get": function () { + return get.call(this); + }, + } + : {})), (set !== undefined + ? { + "set": function (value) { + set.call(this, value); + }, + } + : {}))); +}; +exports.defineAccessors = defineAccessors; +//# sourceMappingURL=defineAccessors.js.map \ No newline at end of file diff --git a/lab/defineAccessors.js.map b/lab/defineAccessors.js.map new file mode 100644 index 0000000..7875dd4 --- /dev/null +++ b/lab/defineAccessors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"defineAccessors.js","sourceRoot":"","sources":["../src/lab/defineAccessors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAO,IAAM,eAAe,GAAG,UAC3B,GAAM,EACN,YAAe,EACf,kBAGC;IAEO,IAAA,GAAG,GAAU,kBAAkB,IAA5B,EAAE,GAAG,GAAK,kBAAkB,IAAvB,CAAwB;IAExC,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,YAAY,iCAChC,CAAC,MAAM,CAAC,wBAAwB,CAAC,GAAG,EAAE,YAAY,CAAC,IAAI;QACtD,YAAY,EAAE,IAAI;QAClB,cAAc,EAAE,IAAI;KACvB,CAAC,GACC,CAAC,GAAG,KAAK,SAAS;QACjB,CAAC,CAAC;YACI,KAAK,EAAE;gBACH,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC1B,CAAC;SACJ;QACH,CAAC,CAAC,EAAE,CAAC,GACN,CAAC,GAAG,KAAK,SAAS;QACjB,CAAC,CAAC;YACI,KAAK,EAAE,UAAU,KAAW;gBACxB,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAC1B,CAAC;SACJ;QACH,CAAC,CAAC,EAAE,CAAC,EACX,CAAC;AACP,CAAC,CAAC;AA9BW,QAAA,eAAe,mBA8B1B"} \ No newline at end of file diff --git a/lab/index.d.ts b/lab/index.d.ts new file mode 100644 index 0000000..1817599 --- /dev/null +++ b/lab/index.d.ts @@ -0,0 +1,5 @@ +export * from "./defineAccessors"; +export * from "./overwriteReadonlyProp"; +export * from "./PromiseOrNot"; +export * from "./UnpackTypeGuard"; +export * from "./withDefaults"; diff --git a/lab/index.js b/lab/index.js new file mode 100644 index 0000000..5daa01b --- /dev/null +++ b/lab/index.js @@ -0,0 +1,22 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./defineAccessors"), exports); +__exportStar(require("./overwriteReadonlyProp"), exports); +__exportStar(require("./PromiseOrNot"), exports); +__exportStar(require("./UnpackTypeGuard"), exports); +__exportStar(require("./withDefaults"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lab/index.js.map b/lab/index.js.map new file mode 100644 index 0000000..5037606 --- /dev/null +++ b/lab/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lab/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,0DAAwC;AACxC,iDAA+B;AAC/B,oDAAkC;AAClC,iDAA+B"} \ No newline at end of file diff --git a/lab/overwriteReadonlyProp.d.ts b/lab/overwriteReadonlyProp.d.ts new file mode 100644 index 0000000..225c2c2 --- /dev/null +++ b/lab/overwriteReadonlyProp.d.ts @@ -0,0 +1,7 @@ +/** + * Assign a value to a property even if the object is freezed or if the property is not writable + * Throw if the assignation fail ( for example if the property is non configurable write: false ) + * */ +export declare const overwriteReadonlyProp: (obj: T, propertyName: K, value: T[K]) => T[K]; diff --git a/lab/overwriteReadonlyProp.js b/lab/overwriteReadonlyProp.js new file mode 100644 index 0000000..5a32970 --- /dev/null +++ b/lab/overwriteReadonlyProp.js @@ -0,0 +1,52 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.overwriteReadonlyProp = void 0; +/* eslint-disable no-empty */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +var assert_1 = require("../assert"); +var is_1 = require("../is"); +/** + * Assign a value to a property even if the object is freezed or if the property is not writable + * Throw if the assignation fail ( for example if the property is non configurable write: false ) + * */ +var overwriteReadonlyProp = function (obj, propertyName, value) { + try { + obj[propertyName] = value; + } + catch (_a) { } + if (obj[propertyName] === value) { + return value; + } + var errorDefineProperty = undefined; + var propertyDescriptor = Object.getOwnPropertyDescriptor(obj, propertyName) || { + "enumerable": true, + "configurable": true, + }; + if (!!propertyDescriptor.get) { + throw new Error("Probably a wrong ides to overwrite ".concat(String(propertyName), " getter")); + } + try { + Object.defineProperty(obj, propertyName, __assign(__assign({}, propertyDescriptor), { value: value })); + } + catch (error) { + (0, assert_1.assert)((0, is_1.is)(error)); + errorDefineProperty = error; + } + if (obj[propertyName] !== value) { + throw errorDefineProperty || new Error("Can't assign"); + } + return value; +}; +exports.overwriteReadonlyProp = overwriteReadonlyProp; +//# sourceMappingURL=overwriteReadonlyProp.js.map \ No newline at end of file diff --git a/lab/overwriteReadonlyProp.js.map b/lab/overwriteReadonlyProp.js.map new file mode 100644 index 0000000..6c8264e --- /dev/null +++ b/lab/overwriteReadonlyProp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"overwriteReadonlyProp.js","sourceRoot":"","sources":["../src/lab/overwriteReadonlyProp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,6BAA6B;AAC7B,uDAAuD;AACvD,oCAAmC;AACnC,4BAA2B;AAE3B;;;KAGK;AACE,IAAM,qBAAqB,GAAG,UACjC,GAAM,EACN,YAAe,EACf,KAAW;IAEX,IAAI;QACA,GAAG,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC;KAC7B;IAAC,WAAM,GAAE;IAEV,IAAI,GAAG,CAAC,YAAY,CAAC,KAAK,KAAK,EAAE;QAC7B,OAAO,KAAK,CAAC;KAChB;IAED,IAAI,mBAAmB,GAAsB,SAAS,CAAC;IAEvD,IAAM,kBAAkB,GAAuB,MAAM,CAAC,wBAAwB,CAC1E,GAAG,EACH,YAAY,CACf,IAAI;QACD,YAAY,EAAE,IAAI;QAClB,cAAc,EAAE,IAAI;KACvB,CAAC;IAEF,IAAI,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE;QAC1B,MAAM,IAAI,KAAK,CAAC,6CAAsC,MAAM,CAAC,YAAY,CAAC,YAAS,CAAC,CAAC;KACxF;IAED,IAAI;QACA,MAAM,CAAC,cAAc,CAAC,GAAG,EAAE,YAAY,wBAChC,kBAAkB,KACrB,KAAK,OAAA,IACP,CAAC;KACN;IAAC,OAAO,KAAK,EAAE;QACZ,IAAA,eAAM,EAAC,IAAA,OAAE,EAAQ,KAAK,CAAC,CAAC,CAAC;QACzB,mBAAmB,GAAG,KAAK,CAAC;KAC/B;IAED,IAAI,GAAG,CAAC,YAAY,CAAC,KAAK,KAAK,EAAE;QAC7B,MAAM,mBAAmB,IAAI,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;KAC1D;IAED,OAAO,KAAK,CAAC;AACjB,CAAC,CAAC;AA1CW,QAAA,qBAAqB,yBA0ChC"} \ No newline at end of file diff --git a/lab/withDefaults.d.ts b/lab/withDefaults.d.ts new file mode 100644 index 0000000..e6ec041 --- /dev/null +++ b/lab/withDefaults.d.ts @@ -0,0 +1,16 @@ +import "../tools/Object.fromEntries"; +/** + * Like Function.prototype.bind() but for a function that + * receives their parameters wrapped in an object. + * See documentation for more details: + * https://docs.tsafe.dev/withdefaults + */ +export declare function withDefaults, DefaultKey extends keyof Params, R>(f: (params: Params) => R, defaultParams: keyof Params extends never ? Record : { + [Key in DefaultKey]: Params[Key]; +}): (params: { + [Key in keyof Omit]: Params[Key]; +} & { + defaultsOverwrite?: { + [Key in DefaultKey]?: [Params[Key]]; + }; +}) => R; diff --git a/lab/withDefaults.js b/lab/withDefaults.js new file mode 100644 index 0000000..81ae1bc --- /dev/null +++ b/lab/withDefaults.js @@ -0,0 +1,66 @@ +"use strict"; +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +var __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +}; +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.withDefaults = void 0; +/* eslint-disable @typescript-eslint/ban-ts-comment */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +require("../tools/Object.fromEntries"); +/** + * Like Function.prototype.bind() but for a function that + * receives their parameters wrapped in an object. + * See documentation for more details: + * https://docs.tsafe.dev/withdefaults + */ +function withDefaults(f, defaultParams) { + return function (params) { + var _a = params.defaultsOverwrite, defaultsOverwrite = _a === void 0 ? {} : _a, actualParams = __rest(params, ["defaultsOverwrite"]); + return f(__assign(__assign(__assign({}, defaultParams), actualParams), Object.fromEntries(Object.entries(defaultsOverwrite) + .filter(function (_a) { + var _b = __read(_a, 2), value = _b[1]; + return value !== undefined; + }) + .map(function (_a) { + var _b = __read(_a, 2), key = _b[0], value = _b[1]; + return [key, value[0]]; + })))); + }; +} +exports.withDefaults = withDefaults; +//# sourceMappingURL=withDefaults.js.map \ No newline at end of file diff --git a/lab/withDefaults.js.map b/lab/withDefaults.js.map new file mode 100644 index 0000000..4820e9a --- /dev/null +++ b/lab/withDefaults.js.map @@ -0,0 +1 @@ +{"version":3,"file":"withDefaults.js","sourceRoot":"","sources":["../src/lab/withDefaults.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAsD;AACtD,uDAAuD;AACvD,uCAAqC;AACrC;;;;;GAKG;AACH,SAAgB,YAAY,CACxB,CAAwB,EACxB,aAE0C;IAM1C,OAAO,UAAA,MAAM;QACD,IAAA,KAA4C,MAAM,kBAA5B,EAAtB,iBAAiB,mBAAG,EAAE,KAAA,EAAK,YAAY,UAAK,MAAM,EAApD,qBAA2C,CAAF,CAAY;QAE3D,OAAO,CAAC,CAAC,+BACF,aAAa,GACb,YAAY,GACZ,MAAM,CAAC,WAAW,CACjB,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC;aAC5B,MAAM,CAAC,UAAC,EAAS;gBAAT,KAAA,aAAS,EAAN,KAAK,QAAA;YAAM,OAAA,KAAK,KAAK,SAAS;QAAnB,CAAmB,CAAC;aAC1C,GAAG,CAAC,UAAC,EAAY;gBAAZ,KAAA,aAAY,EAAX,GAAG,QAAA,EAAE,KAAK,QAAA;YAAM,OAAA,CAAC,GAAG,EAAG,KAAa,CAAC,CAAC,CAAC,CAAC;QAAxB,CAAwB,CAAC,CACvD,CACG,CAAC,CAAC;IACd,CAAC,CAAC;AACN,CAAC;AAvBD,oCAuBC"} \ No newline at end of file diff --git a/noUndefined.d.ts b/noUndefined.d.ts new file mode 100644 index 0000000..51e3bbc --- /dev/null +++ b/noUndefined.d.ts @@ -0,0 +1,9 @@ +/** + * Removes the enumerable properties whose values are + * undefined. + * + * Example: + * noUndefined({ "foo": undefined, "bar": 3 }) returns + * a new object { "bar": 3 } + */ +export declare function noUndefined(obj: T): T; diff --git a/noUndefined.js b/noUndefined.js new file mode 100644 index 0000000..38de3a4 --- /dev/null +++ b/noUndefined.js @@ -0,0 +1,25 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/ban-types */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.noUndefined = void 0; +/** + * Removes the enumerable properties whose values are + * undefined. + * + * Example: + * noUndefined({ "foo": undefined, "bar": 3 }) returns + * a new object { "bar": 3 } + */ +function noUndefined(obj) { + var out = {}; + for (var key in obj) { + if (obj[key] === undefined) { + continue; + } + out[key] = obj[key]; + } + return out; +} +exports.noUndefined = noUndefined; +//# sourceMappingURL=noUndefined.js.map \ No newline at end of file diff --git a/noUndefined.js.map b/noUndefined.js.map new file mode 100644 index 0000000..0cdec46 --- /dev/null +++ b/noUndefined.js.map @@ -0,0 +1 @@ +{"version":3,"file":"noUndefined.js","sourceRoot":"","sources":["src/noUndefined.ts"],"names":[],"mappings":";AAAA,uDAAuD;AACvD,iDAAiD;;;AAEjD;;;;;;;GAOG;AACH,SAAgB,WAAW,CAAmB,GAAM;IAChD,IAAM,GAAG,GAAe,EAAS,CAAC;IAElC,KAAK,IAAM,GAAG,IAAI,GAAG,EAAE;QACnB,IAAI,GAAG,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;YACxB,SAAS;SACZ;QAED,GAAG,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;KACvB;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AAZD,kCAYC"} \ No newline at end of file diff --git a/objectEntries.d.ts b/objectEntries.d.ts new file mode 100644 index 0000000..723eabc --- /dev/null +++ b/objectEntries.d.ts @@ -0,0 +1,8 @@ +/** https://docs.tsafe.dev/objectentries */ +export declare function objectEntries>(o: O): Exclude<{ + [Key in keyof O]: [Key, O[Key]]; +}[keyof O], undefined>[]; +/** Return type of objectEntries https://docs.tsafe.dev/objectentries */ +export type ObjectEntries> = Exclude<{ + [Key in keyof O]: [Key, O[Key]]; +}[keyof O], undefined>[]; diff --git a/objectEntries.js b/objectEntries.js new file mode 100644 index 0000000..9ed95e4 --- /dev/null +++ b/objectEntries.js @@ -0,0 +1,10 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.objectEntries = void 0; +/** https://docs.tsafe.dev/objectentries */ +function objectEntries(o) { + return Object.entries(o); +} +exports.objectEntries = objectEntries; +//# sourceMappingURL=objectEntries.js.map \ No newline at end of file diff --git a/objectEntries.js.map b/objectEntries.js.map new file mode 100644 index 0000000..db776db --- /dev/null +++ b/objectEntries.js.map @@ -0,0 +1 @@ +{"version":3,"file":"objectEntries.js","sourceRoot":"","sources":["src/objectEntries.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;AAEvD,2CAA2C;AAC3C,SAAgB,aAAa,CACzB,CAAI;IAEJ,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAQ,CAAC;AACpC,CAAC;AAJD,sCAIC"} \ No newline at end of file diff --git a/objectFromEntries.d.ts b/objectFromEntries.d.ts new file mode 100644 index 0000000..09e62db --- /dev/null +++ b/objectFromEntries.d.ts @@ -0,0 +1,8 @@ +/** https://docs.tsafe.dev/objectFromEntries */ +export declare function objectFromEntries(entries: readonly Entry[]): { + [Key in Entry[0]]: Extract[1]; +}; +/** Return type of objectFromEntries https://docs.tsafe.dev/objectFromEntries */ +export type ObjectFromEntries = { + [Key in Entry[0]]: Extract[1]; +}; diff --git a/objectFromEntries.js b/objectFromEntries.js new file mode 100644 index 0000000..dfd9517 --- /dev/null +++ b/objectFromEntries.js @@ -0,0 +1,10 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.objectFromEntries = void 0; +/** https://docs.tsafe.dev/objectFromEntries */ +function objectFromEntries(entries) { + return Object.fromEntries(entries); +} +exports.objectFromEntries = objectFromEntries; +//# sourceMappingURL=objectFromEntries.js.map \ No newline at end of file diff --git a/objectFromEntries.js.map b/objectFromEntries.js.map new file mode 100644 index 0000000..7067ac6 --- /dev/null +++ b/objectFromEntries.js.map @@ -0,0 +1 @@ +{"version":3,"file":"objectFromEntries.js","sourceRoot":"","sources":["src/objectFromEntries.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;AAEvD,+CAA+C;AAC/C,SAAgB,iBAAiB,CAC7B,OAAyB;IAEzB,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAQ,CAAC;AAC9C,CAAC;AAJD,8CAIC"} \ No newline at end of file diff --git a/objectKeys.d.ts b/objectKeys.d.ts new file mode 100644 index 0000000..103b048 --- /dev/null +++ b/objectKeys.d.ts @@ -0,0 +1,2 @@ +/** https://docs.tsafe.dev/objectKeys */ +export declare function objectKeys>(o: T): (keyof T)[]; diff --git a/objectKeys.js b/objectKeys.js new file mode 100644 index 0000000..3dc1c30 --- /dev/null +++ b/objectKeys.js @@ -0,0 +1,10 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.objectKeys = void 0; +/** https://docs.tsafe.dev/objectKeys */ +function objectKeys(o) { + return Object.keys(o); +} +exports.objectKeys = objectKeys; +//# sourceMappingURL=objectKeys.js.map \ No newline at end of file diff --git a/objectKeys.js.map b/objectKeys.js.map new file mode 100644 index 0000000..9d4adca --- /dev/null +++ b/objectKeys.js.map @@ -0,0 +1 @@ +{"version":3,"file":"objectKeys.js","sourceRoot":"","sources":["src/objectKeys.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;AAEvD,wCAAwC;AACxC,SAAgB,UAAU,CAAoC,CAAI;IAC9D,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAQ,CAAC;AACjC,CAAC;AAFD,gCAEC"} \ No newline at end of file diff --git a/package.json b/package.json index e0f679a..575ae9e 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/mod.ts", - "test:node": "ts-node test/index.ts", - "lint:check": "eslint . --ext .ts,.tsx", - "lint": "npm run lint:check -- --fix", - "_format": "prettier '**/*.{ts,tsx,json,md}'", - "format": "npm run _format -- --write", - "format:check": "npm run _format -- --list-different" - }, "lint-staged": { "*.{ts,tsx}": [ "eslint --fix" @@ -35,35 +21,315 @@ }, "author": "u/garronej", "license": "MIT", - "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": "./dist/*.js", - "import": "./dist/esm/*.mjs", - "types": "./dist/*.d.ts" + "require": "./index.js", + "import": "./esm/index.mjs", + "types": "./index.d.ts" }, "./lab": { - "require": "./dist/lab/index.js", - "import": "./dist/esm/lab/index.mjs", - "types": "./dist/lab/index.d.ts" + "require": "./lab/index.js", + "import": "./esm/lab/index.mjs", + "types": "./lab/index.d.ts" }, "./tools": { - "require": "./dist/tools/index.js", - "import": "./dist/esm/tools/index.mjs", - "types": "./dist/tools/index.d.ts" + "require": "./tools/index.js", + "import": "./esm/tools/index.mjs", + "types": "./tools/index.d.ts" } }, "files": [ - "src/", - "dist/", - "!dist/tsconfig.tsbuildinfo" + "src/Equals.ts", + "src/Extends.ts", + "src/MethodNames.ts", + "src/Not.ts", + "src/Param0.ts", + "src/Parameters.ts", + "src/PickOptionals.ts", + "src/PickRequired.ts", + "src/Reflect.ts", + "src/ReturnType.ts", + "src/UnionToIntersection.ts", + "src/UnpackPromise.ts", + "src/assert.ts", + "src/capitalize.ts", + "src/exclude.ts", + "src/flip.ts", + "src/id.ts", + "src/index.ts", + "src/is.ts", + "src/isAmong.ts", + "src/isPromiseLike.ts", + "src/lab/PromiseOrNot.ts", + "src/lab/UnpackTypeGuard.ts", + "src/lab/defineAccessors.ts", + "src/lab/index.ts", + "src/lab/overwriteReadonlyProp.ts", + "src/lab/withDefaults.ts", + "src/noUndefined.ts", + "src/objectEntries.ts", + "src/objectFromEntries.ts", + "src/objectKeys.ts", + "src/symToStr.ts", + "src/tools/Object.fromEntries.ts", + "src/tools/StrictEquals.ts", + "src/tools/Unite.ts", + "src/tools/getProjectRoot.ts", + "src/tools/index.ts", + "src/tools/toUpperCase.ts", + "src/typeGuard.ts", + "src/uncapitalize.ts", + "src/zz_internal/assertIsRefWrapper.ts", + "Equals.d.ts", + "Equals.js", + "Equals.js.map", + "Extends.d.ts", + "Extends.js", + "Extends.js.map", + "MethodNames.d.ts", + "MethodNames.js", + "MethodNames.js.map", + "Not.d.ts", + "Not.js", + "Not.js.map", + "Param0.d.ts", + "Param0.js", + "Param0.js.map", + "Parameters.d.ts", + "Parameters.js", + "Parameters.js.map", + "PickOptionals.d.ts", + "PickOptionals.js", + "PickOptionals.js.map", + "PickRequired.d.ts", + "PickRequired.js", + "PickRequired.js.map", + "Reflect.d.ts", + "Reflect.js", + "Reflect.js.map", + "ReturnType.d.ts", + "ReturnType.js", + "ReturnType.js.map", + "UnionToIntersection.d.ts", + "UnionToIntersection.js", + "UnionToIntersection.js.map", + "UnpackPromise.d.ts", + "UnpackPromise.js", + "UnpackPromise.js.map", + "assert.d.ts", + "assert.js", + "assert.js.map", + "capitalize.d.ts", + "capitalize.js", + "capitalize.js.map", + "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/isAmong.d.ts", + "esm/isAmong.mjs", + "esm/isAmong.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/index.d.ts", + "esm/lab/index.mjs", + "esm/lab/index.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/index.d.ts", + "esm/tools/index.mjs", + "esm/tools/index.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", + "isAmong.d.ts", + "isAmong.js", + "isAmong.js.map", + "isPromiseLike.d.ts", + "isPromiseLike.js", + "isPromiseLike.js.map", + "lab/PromiseOrNot.d.ts", + "lab/PromiseOrNot.js", + "lab/PromiseOrNot.js.map", + "lab/UnpackTypeGuard.d.ts", + "lab/UnpackTypeGuard.js", + "lab/UnpackTypeGuard.js.map", + "lab/defineAccessors.d.ts", + "lab/defineAccessors.js", + "lab/defineAccessors.js.map", + "lab/index.d.ts", + "lab/index.js", + "lab/index.js.map", + "lab/overwriteReadonlyProp.d.ts", + "lab/overwriteReadonlyProp.js", + "lab/overwriteReadonlyProp.js.map", + "lab/withDefaults.d.ts", + "lab/withDefaults.js", + "lab/withDefaults.js.map", + "noUndefined.d.ts", + "noUndefined.js", + "noUndefined.js.map", + "objectEntries.d.ts", + "objectEntries.js", + "objectEntries.js.map", + "objectFromEntries.d.ts", + "objectFromEntries.js", + "objectFromEntries.js.map", + "objectKeys.d.ts", + "objectKeys.js", + "objectKeys.js.map", + "symToStr.d.ts", + "symToStr.js", + "symToStr.js.map", + "tools/Object.fromEntries.d.ts", + "tools/Object.fromEntries.js", + "tools/Object.fromEntries.js.map", + "tools/StrictEquals.d.ts", + "tools/StrictEquals.js", + "tools/StrictEquals.js.map", + "tools/Unite.d.ts", + "tools/Unite.js", + "tools/Unite.js.map", + "tools/getProjectRoot.d.ts", + "tools/getProjectRoot.js", + "tools/getProjectRoot.js.map", + "tools/index.d.ts", + "tools/index.js", + "tools/index.js.map", + "tools/toUpperCase.d.ts", + "tools/toUpperCase.js", + "tools/toUpperCase.js.map", + "typeGuard.d.ts", + "typeGuard.js", + "typeGuard.js.map", + "uncapitalize.d.ts", + "uncapitalize.js", + "uncapitalize.js.map", + "zz_internal/assertIsRefWrapper.d.ts", + "zz_internal/assertIsRefWrapper.js", + "zz_internal/assertIsRefWrapper.js.map" ], "keywords": [], "homepage": "https://github.com/garronej/tsafe", diff --git a/symToStr.d.ts b/symToStr.d.ts new file mode 100644 index 0000000..2857462 --- /dev/null +++ b/symToStr.d.ts @@ -0,0 +1,2 @@ +/** @see */ +export declare function symToStr>(wrap: T): Exclude; diff --git a/symToStr.js b/symToStr.js new file mode 100644 index 0000000..9901423 --- /dev/null +++ b/symToStr.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.symToStr = void 0; +/** @see */ +function symToStr(wrap) { + // @ts-expect-error: We know better + 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..1d0030d --- /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,mCAAmC;IACnC,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAChC,CAAC;AAHD,4BAGC"} \ No newline at end of file diff --git a/tools/Object.fromEntries.d.ts b/tools/Object.fromEntries.d.ts new file mode 100644 index 0000000..cb0ff5c --- /dev/null +++ b/tools/Object.fromEntries.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/tools/Object.fromEntries.js b/tools/Object.fromEntries.js new file mode 100644 index 0000000..caf91f2 --- /dev/null +++ b/tools/Object.fromEntries.js @@ -0,0 +1,35 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +var __read = (this && this.__read) || function (o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +if (!Object.fromEntries) { + Object.defineProperty(Object, "fromEntries", { + "value": function (entries) { + if (!entries || !entries[Symbol.iterator]) { + throw new Error("Object.fromEntries() requires a single iterable argument"); + } + var o = {}; + Object.keys(entries).forEach(function (key) { + var _a = __read(entries[key], 2), k = _a[0], v = _a[1]; + o[k] = v; + }); + return o; + }, + }); +} +//# sourceMappingURL=Object.fromEntries.js.map \ No newline at end of file diff --git a/tools/Object.fromEntries.js.map b/tools/Object.fromEntries.js.map new file mode 100644 index 0000000..fe73689 --- /dev/null +++ b/tools/Object.fromEntries.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Object.fromEntries.js","sourceRoot":"","sources":["../src/tools/Object.fromEntries.ts"],"names":[],"mappings":";AAAA,uDAAuD;;;;;;;;;;;;;;;;;;AAEvD,IAAI,CAAE,MAAc,CAAC,WAAW,EAAE;IAC9B,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,aAAa,EAAE;QACzC,OAAO,EAAE,UAAU,OAAY;YAC3B,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE;gBACvC,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;aAC/E;YAED,IAAM,CAAC,GAAQ,EAAE,CAAC;YAElB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,UAAA,GAAG;gBACtB,IAAA,KAAA,OAAS,OAAO,CAAC,GAAG,CAAC,IAAA,EAApB,CAAC,QAAA,EAAE,CAAC,QAAgB,CAAC;gBAE5B,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;YACb,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,CAAC;QACb,CAAC;KACJ,CAAC,CAAC;CACN"} \ No newline at end of file diff --git a/tools/StrictEquals.d.ts b/tools/StrictEquals.d.ts new file mode 100644 index 0000000..0871a91 --- /dev/null +++ b/tools/StrictEquals.d.ts @@ -0,0 +1 @@ +export type StrictEquals = (() => A extends A2 ? true : false) extends () => A extends A1 ? true : false ? true : false; diff --git a/tools/StrictEquals.js b/tools/StrictEquals.js new file mode 100644 index 0000000..1fb6ccc --- /dev/null +++ b/tools/StrictEquals.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=StrictEquals.js.map \ No newline at end of file diff --git a/tools/StrictEquals.js.map b/tools/StrictEquals.js.map new file mode 100644 index 0000000..842deab --- /dev/null +++ b/tools/StrictEquals.js.map @@ -0,0 +1 @@ +{"version":3,"file":"StrictEquals.js","sourceRoot":"","sources":["../src/tools/StrictEquals.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tools/Unite.d.ts b/tools/Unite.d.ts new file mode 100644 index 0000000..a75c362 --- /dev/null +++ b/tools/Unite.d.ts @@ -0,0 +1,3 @@ +export type Unite = T extends Record ? { + [Key in keyof T]: T[Key]; +} : T; diff --git a/tools/Unite.js b/tools/Unite.js new file mode 100644 index 0000000..85f5b5d --- /dev/null +++ b/tools/Unite.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=Unite.js.map \ No newline at end of file diff --git a/tools/Unite.js.map b/tools/Unite.js.map new file mode 100644 index 0000000..13e4c6f --- /dev/null +++ b/tools/Unite.js.map @@ -0,0 +1 @@ +{"version":3,"file":"Unite.js","sourceRoot":"","sources":["../src/tools/Unite.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tools/getProjectRoot.d.ts b/tools/getProjectRoot.d.ts new file mode 100644 index 0000000..7927ee7 --- /dev/null +++ b/tools/getProjectRoot.d.ts @@ -0,0 +1 @@ +export declare function getProjectRoot(): string; diff --git a/tools/getProjectRoot.js b/tools/getProjectRoot.js new file mode 100644 index 0000000..c71599c --- /dev/null +++ b/tools/getProjectRoot.js @@ -0,0 +1,43 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getProjectRoot = void 0; +var fs = __importStar(require("fs")); +var path = __importStar(require("path")); +function getProjectRootRec(dirPath) { + if (fs.existsSync(path.join(dirPath, "package.json"))) { + return dirPath; + } + return getProjectRootRec(path.join(dirPath, "..")); +} +var result = undefined; +function getProjectRoot() { + if (result !== undefined) { + return result; + } + return (result = getProjectRootRec(__dirname)); +} +exports.getProjectRoot = getProjectRoot; +//# sourceMappingURL=getProjectRoot.js.map \ No newline at end of file diff --git a/tools/getProjectRoot.js.map b/tools/getProjectRoot.js.map new file mode 100644 index 0000000..54cd90d --- /dev/null +++ b/tools/getProjectRoot.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getProjectRoot.js","sourceRoot":"","sources":["../src/tools/getProjectRoot.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AACzB,yCAA6B;AAE7B,SAAS,iBAAiB,CAAC,OAAe;IACtC,IAAI,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,EAAE;QACnD,OAAO,OAAO,CAAC;KAClB;IACD,OAAO,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,IAAI,MAAM,GAAuB,SAAS,CAAC;AAE3C,SAAgB,cAAc;IAC1B,IAAI,MAAM,KAAK,SAAS,EAAE;QACtB,OAAO,MAAM,CAAC;KACjB;IAED,OAAO,CAAC,MAAM,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC;AACnD,CAAC;AAND,wCAMC"} \ No newline at end of file diff --git a/tools/index.d.ts b/tools/index.d.ts new file mode 100644 index 0000000..5c83482 --- /dev/null +++ b/tools/index.d.ts @@ -0,0 +1,5 @@ +export * from "./getProjectRoot"; +export * from "./Object.fromEntries"; +export * from "./StrictEquals"; +export * from "./toUpperCase"; +export * from "./Unite"; diff --git a/tools/index.js b/tools/index.js new file mode 100644 index 0000000..be67ef6 --- /dev/null +++ b/tools/index.js @@ -0,0 +1,22 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +__exportStar(require("./getProjectRoot"), exports); +__exportStar(require("./Object.fromEntries"), exports); +__exportStar(require("./StrictEquals"), exports); +__exportStar(require("./toUpperCase"), exports); +__exportStar(require("./Unite"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/index.js.map b/tools/index.js.map new file mode 100644 index 0000000..487509f --- /dev/null +++ b/tools/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/tools/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,uDAAqC;AACrC,iDAA+B;AAC/B,gDAA8B;AAC9B,0CAAwB"} \ No newline at end of file diff --git a/tools/toUpperCase.d.ts b/tools/toUpperCase.d.ts new file mode 100644 index 0000000..c2dd61b --- /dev/null +++ b/tools/toUpperCase.d.ts @@ -0,0 +1 @@ +export declare function toUpperCase(str: string): string; diff --git a/tools/toUpperCase.js b/tools/toUpperCase.js new file mode 100644 index 0000000..0748db3 --- /dev/null +++ b/tools/toUpperCase.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toUpperCase = void 0; +function toUpperCase(str) { + return str.toUpperCase(); +} +exports.toUpperCase = toUpperCase; +//# sourceMappingURL=toUpperCase.js.map \ No newline at end of file diff --git a/tools/toUpperCase.js.map b/tools/toUpperCase.js.map new file mode 100644 index 0000000..952af8d --- /dev/null +++ b/tools/toUpperCase.js.map @@ -0,0 +1 @@ +{"version":3,"file":"toUpperCase.js","sourceRoot":"","sources":["../src/tools/toUpperCase.ts"],"names":[],"mappings":";;;AAAA,SAAgB,WAAW,CAAC,GAAW;IACnC,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC;AAC7B,CAAC;AAFD,kCAEC"} \ No newline at end of file diff --git a/tsconfig.tsbuildinfo b/tsconfig.tsbuildinfo new file mode 100644 index 0000000..2a10037 --- /dev/null +++ b/tsconfig.tsbuildinfo @@ -0,0 +1 @@ +{"program":{"fileNames":["../node_modules/typescript/lib/lib.es5.d.ts","../node_modules/typescript/lib/lib.es2015.d.ts","../node_modules/typescript/lib/lib.es2016.d.ts","../node_modules/typescript/lib/lib.es2017.d.ts","../node_modules/typescript/lib/lib.es2018.d.ts","../node_modules/typescript/lib/lib.es2019.d.ts","../node_modules/typescript/lib/lib.es2020.d.ts","../node_modules/typescript/lib/lib.dom.d.ts","../node_modules/typescript/lib/lib.es2015.core.d.ts","../node_modules/typescript/lib/lib.es2015.collection.d.ts","../node_modules/typescript/lib/lib.es2015.generator.d.ts","../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../node_modules/typescript/lib/lib.es2015.promise.d.ts","../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../node_modules/typescript/lib/lib.es2017.object.d.ts","../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2017.string.d.ts","../node_modules/typescript/lib/lib.es2017.intl.d.ts","../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../node_modules/typescript/lib/lib.es2018.intl.d.ts","../node_modules/typescript/lib/lib.es2018.promise.d.ts","../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../node_modules/typescript/lib/lib.es2019.array.d.ts","../node_modules/typescript/lib/lib.es2019.object.d.ts","../node_modules/typescript/lib/lib.es2019.string.d.ts","../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../node_modules/typescript/lib/lib.es2019.intl.d.ts","../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../node_modules/typescript/lib/lib.es2020.date.d.ts","../node_modules/typescript/lib/lib.es2020.promise.d.ts","../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../node_modules/typescript/lib/lib.es2020.string.d.ts","../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../node_modules/typescript/lib/lib.es2020.intl.d.ts","../node_modules/typescript/lib/lib.es2020.number.d.ts","../node_modules/typescript/lib/lib.esnext.intl.d.ts","../node_modules/typescript/lib/lib.decorators.d.ts","../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../src/tools/Unite.ts","../src/tools/StrictEquals.ts","../src/Equals.ts","../src/Extends.ts","../src/MethodNames.ts","../src/Not.ts","../src/Parameters.ts","../src/Param0.ts","../src/PickOptionals.ts","../src/PickRequired.ts","../src/Reflect.ts","../src/ReturnType.ts","../src/UnionToIntersection.ts","../src/UnpackPromise.ts","../src/id.ts","../src/zz_internal/assertIsRefWrapper.ts","../src/is.ts","../src/lab/overwriteReadonlyProp.ts","../src/assert.ts","../src/capitalize.ts","../src/exclude.ts","../src/flip.ts","../src/isPromiseLike.ts","../src/objectKeys.ts","../src/typeGuard.ts","../src/isAmong.ts","../src/objectEntries.ts","../src/objectFromEntries.ts","../src/noUndefined.ts","../src/uncapitalize.ts","../src/index.ts","../src/symToStr.ts","../src/lab/PromiseOrNot.ts","../src/lab/UnpackTypeGuard.ts","../src/lab/defineAccessors.ts","../src/tools/Object.fromEntries.ts","../src/lab/withDefaults.ts","../src/lab/index.ts","../src/tools/getProjectRoot.ts","../src/tools/toUpperCase.ts","../src/tools/index.ts","../node_modules/@types/comment-json/index.d.ts","../node_modules/@types/json-schema/index.d.ts","../node_modules/@types/node/assert.d.ts","../node_modules/@types/node/assert/strict.d.ts","../node_modules/@types/node/globals.d.ts","../node_modules/@types/node/async_hooks.d.ts","../node_modules/@types/node/buffer.d.ts","../node_modules/@types/node/child_process.d.ts","../node_modules/@types/node/cluster.d.ts","../node_modules/@types/node/console.d.ts","../node_modules/@types/node/constants.d.ts","../node_modules/@types/node/crypto.d.ts","../node_modules/@types/node/dgram.d.ts","../node_modules/@types/node/diagnostics_channel.d.ts","../node_modules/@types/node/dns.d.ts","../node_modules/@types/node/dns/promises.d.ts","../node_modules/@types/node/domain.d.ts","../node_modules/@types/node/dom-events.d.ts","../node_modules/@types/node/events.d.ts","../node_modules/@types/node/fs.d.ts","../node_modules/@types/node/fs/promises.d.ts","../node_modules/@types/node/http.d.ts","../node_modules/@types/node/http2.d.ts","../node_modules/@types/node/https.d.ts","../node_modules/@types/node/inspector.d.ts","../node_modules/@types/node/module.d.ts","../node_modules/@types/node/net.d.ts","../node_modules/@types/node/os.d.ts","../node_modules/@types/node/path.d.ts","../node_modules/@types/node/perf_hooks.d.ts","../node_modules/@types/node/process.d.ts","../node_modules/@types/node/punycode.d.ts","../node_modules/@types/node/querystring.d.ts","../node_modules/@types/node/readline.d.ts","../node_modules/@types/node/readline/promises.d.ts","../node_modules/@types/node/repl.d.ts","../node_modules/@types/node/stream.d.ts","../node_modules/@types/node/stream/promises.d.ts","../node_modules/@types/node/stream/consumers.d.ts","../node_modules/@types/node/stream/web.d.ts","../node_modules/@types/node/string_decoder.d.ts","../node_modules/@types/node/test.d.ts","../node_modules/@types/node/timers.d.ts","../node_modules/@types/node/timers/promises.d.ts","../node_modules/@types/node/tls.d.ts","../node_modules/@types/node/trace_events.d.ts","../node_modules/@types/node/tty.d.ts","../node_modules/@types/node/url.d.ts","../node_modules/@types/node/util.d.ts","../node_modules/@types/node/v8.d.ts","../node_modules/@types/node/vm.d.ts","../node_modules/@types/node/wasi.d.ts","../node_modules/@types/node/worker_threads.d.ts","../node_modules/@types/node/zlib.d.ts","../node_modules/@types/node/globals.global.d.ts","../node_modules/@types/node/index.d.ts","../node_modules/@types/parse-json/index.d.ts"],"fileInfos":[{"version":"6a6b471e7e43e15ef6f8fe617a22ce4ecb0e34efa6c3dfcfe7cebd392bcca9d2","affectsGlobalScope":true},"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","dc48272d7c333ccf58034c0026162576b7d50ea0e69c3b9292f803fc20720fd5","27147504487dc1159369da4f4da8a26406364624fa9bc3db632f7d94a5bae2c3","5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4",{"version":"fcd3ecc9f764f06f4d5c467677f4f117f6abf49dee6716283aa204ff1162498b","affectsGlobalScope":true},{"version":"f296963760430fb65b4e5d91f0ed770a91c6e77455bacf8fa23a1501654ede0e","affectsGlobalScope":true},{"version":"5114a95689b63f96b957e00216bc04baf9e1a1782aa4d8ee7e5e9acbf768e301","affectsGlobalScope":true},{"version":"4443e68b35f3332f753eacc66a04ac1d2053b8b035a0e0ac1d455392b5e243b3","affectsGlobalScope":true},{"version":"ab22100fdd0d24cfc2cc59d0a00fc8cf449830d9c4030dc54390a46bd562e929","affectsGlobalScope":true},{"version":"f7bd636ae3a4623c503359ada74510c4005df5b36de7f23e1db8a5c543fd176b","affectsGlobalScope":true},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true},{"version":"0c20f4d2358eb679e4ae8a4432bdd96c857a2960fd6800b21ec4008ec59d60ea","affectsGlobalScope":true},{"version":"36ae84ccc0633f7c0787bc6108386c8b773e95d3b052d9464a99cd9b8795fbec","affectsGlobalScope":true},{"version":"82d0d8e269b9eeac02c3bd1c9e884e85d483fcb2cd168bccd6bc54df663da031","affectsGlobalScope":true},{"version":"b8deab98702588840be73d67f02412a2d45a417a3c097b2e96f7f3a42ac483d1","affectsGlobalScope":true},{"version":"4738f2420687fd85629c9efb470793bb753709c2379e5f85bc1815d875ceadcd","affectsGlobalScope":true},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true},{"version":"376d554d042fb409cb55b5cbaf0b2b4b7e669619493c5d18d5fa8bd67273f82a","affectsGlobalScope":true},{"version":"9fc46429fbe091ac5ad2608c657201eb68b6f1b8341bd6d670047d32ed0a88fa","affectsGlobalScope":true},{"version":"61c37c1de663cf4171e1192466e52c7a382afa58da01b1dc75058f032ddf0839","affectsGlobalScope":true},{"version":"c4138a3dd7cd6cf1f363ca0f905554e8d81b45844feea17786cdf1626cb8ea06","affectsGlobalScope":true},{"version":"6ff3e2452b055d8f0ec026511c6582b55d935675af67cdb67dd1dc671e8065df","affectsGlobalScope":true},{"version":"03de17b810f426a2f47396b0b99b53a82c1b60e9cba7a7edda47f9bb077882f4","affectsGlobalScope":true},{"version":"8184c6ddf48f0c98429326b428478ecc6143c27f79b79e85740f17e6feb090f1","affectsGlobalScope":true},{"version":"261c4d2cf86ac5a89ad3fb3fafed74cbb6f2f7c1d139b0540933df567d64a6ca","affectsGlobalScope":true},{"version":"6af1425e9973f4924fca986636ac19a0cf9909a7e0d9d3009c349e6244e957b6","affectsGlobalScope":true},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true},{"version":"15a630d6817718a2ddd7088c4f83e4673fde19fa992d2eae2cf51132a302a5d3","affectsGlobalScope":true},{"version":"b7e9f95a7387e3f66be0ed6db43600c49cec33a3900437ce2fd350d9b7cb16f2","affectsGlobalScope":true},{"version":"01e0ee7e1f661acedb08b51f8a9b7d7f959e9cdb6441360f06522cc3aea1bf2e","affectsGlobalScope":true},{"version":"ac17a97f816d53d9dd79b0d235e1c0ed54a8cc6a0677e9a3d61efb480b2a3e4e","affectsGlobalScope":true},{"version":"bf14a426dbbf1022d11bd08d6b8e709a2e9d246f0c6c1032f3b2edb9a902adbe","affectsGlobalScope":true},{"version":"ec0104fee478075cb5171e5f4e3f23add8e02d845ae0165bfa3f1099241fa2aa","affectsGlobalScope":true},{"version":"2b72d528b2e2fe3c57889ca7baef5e13a56c957b946906d03767c642f386bbc3","affectsGlobalScope":true},{"version":"9cc66b0513ad41cb5f5372cca86ef83a0d37d1c1017580b7dace3ea5661836df","affectsGlobalScope":true},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true},{"version":"307c8b7ebbd7f23a92b73a4c6c0a697beca05b06b036c23a34553e5fe65e4fdc","affectsGlobalScope":true},{"version":"189c0703923150aa30673fa3de411346d727cc44a11c75d05d7cf9ef095daa22","affectsGlobalScope":true},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true},{"version":"f6b19500d5de61452d537a4a495cfae224ff97de8b2afa9b156a14e261d9dc45","signature":"2ac80842d9cafe9e128a13bd4a26813cc5902ececc48de01367f38b52798bf8f"},{"version":"dfcc960e925b12f997798b18975d16d82ca2138907ce163832ea4f753a6026b1","signature":"18b1d10d73315c68e4a35eb2b70a662fa89f8c3a1287180f69415e80f9d4feb9"},{"version":"7fe53ba37b1a4c2d717d605b71497c3089b89802cfd30dbb192be468ae79ec10","signature":"72f1c4c1b9fb45abab255f752dd46cbd01c9126888e2a0cf2db27bc89b6987cb"},{"version":"ba1996d8fc4240710af1a9aae1f15574ee0b2bea3d934e5c54daa928e83ac252","signature":"9cb1cea28e8a631fc4a2ab73c83c0696baab7249b2cfadfd43ffca5e441abb35"},{"version":"a98f362ec9d130a8fee0ebe21a7ea2fcaef9fe9c8d49e228099a6e5bb1dc75b6","signature":"662db21955325cafe247411736fb00e6493204370917f70b67e4b5f3b93c3179"},"02da4f252835cd9cdc1049dc4f27a336f44fc3fb2b587e340d03de45a48830e4",{"version":"ed39a06fcdec4146b81408cbeccb66829034033a05221ea6892177709c472abc","signature":"260a8544fe628efaed6408401910135295ff450af5c8ab76822db61e63ac6a32"},{"version":"eae9988326fd64a1d1ba354e9cbcc2b889909cb50831087e2cc0e8316f02fe33","signature":"e896f32b7424fcc47a39ffaa580e2555f19da3129ad97e19825096e821a92d13"},{"version":"be2476a98a660ac0c6b14cb1bd09285f5d21e0fe5ba12b25adc2443db93421ce","signature":"00f6cb5af8f9ca81ad3e668aa743465587f0a609d3a7fbd113eefd561e6a137b"},{"version":"454fa710bcf4ac32638e96b0c467e1344165c927d221733aa2e77037b3539078","signature":"ce53f0cc7de2c5945e8828cc7651820a2ebdf90503a54de2bcf75f169ad2ad29"},{"version":"aa2712d356ed12a0c72a7f154d0160ecab56f06da86c21540b2645c90f7248d7","signature":"85d2371b2f96b2dd6ec7aa5f2d5099d5d10a4b4c614914f2b531872f7bdb037a"},{"version":"ea83c0ddd554616cfbede4b11b59910f4fc93f8c8001dea25f7837f74fcf3cc7","signature":"1eef420ff81e5840050097a0f15ab7858dca15aff0a2e9c7082c332c6fcef7ec"},{"version":"ea630c2dc976ca3572cf3f1b064ba070f15ad5b67328a1b3e73fbda1dabdc9e4","signature":"f54c9e9d1692e868be8e5da3638a5e38f5d2d1324de7752170d1ab4160d1cc67"},{"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":"9c31e283f7cc8ece5d2728d32e1238498dcb5c28077a3a8f1f7e6dc4bc660521","signature":"a3c85548cae6bf2bd7c45f23c38509038315d10f0400919102bff397112ef25a"},{"version":"cfa42eee23927d15b60d467db75d4c9c48b1d08b3d6511e6386ff77e42f0ee40","signature":"74b94d41129afb2f4ef6dae6669cc52f6352b83d11704e0143bbccbc483c2094"},{"version":"7359a7bd156fb7263f17b59477e22e61c26d646d27f7df3a70a408a43033a2f3","signature":"18f455507ad251d2e04fa76dc6e2a7ccb090329c092913fca6197c5fef5d19eb"},{"version":"2d04d4da6d9c7afae2559a9598ccebb3d1d4fd6b0b420cf7ca8f3c9f20c9a858","signature":"0074b2c395fdd7241199a53b6b5a04c56af5a56366c9108491ea3a07676f364b"},{"version":"8012ea9591da5ff83fa43d1a42c9911736b0f841726bc88a07deb53ae717f41b","signature":"5bb1f84b59523bb590af00c91dbe1d0d13502d8f5d69d20a1f44859fdc1f23b3"},{"version":"d78d41cc68cf3bdcd698165757b0ba5288d8bf4eb409cfd498365ec1557e3eaf","signature":"295d63f0ad3f577a40cbb630ce667e274908c814a2703fc13d103122b8215e9f"},{"version":"2bb83825af7e1950c04621e4d055814333d2cca24eb3aab95918ce95212a3561","signature":"82aeba550610395d2914fd6d1a4606d02b95a2a8b250a52ec303db71590b41b3"},{"version":"b0e20c5407a5e79d50bb90a9b445f4889c7ef562438db770b395515170e9b5e9","signature":"14aff5197faa1b13369c3d455556e61f3f1bd0cd856a9fddefc37714d5fddab5"},{"version":"112299f77f951fe6b8eb50821334f6aebcf574b5b7d89e2431b91fe1df55c7ab","signature":"4dde3a0c022816a842ebcaf7375b5e696736efd4836280377ec0aa0107879e4d"},{"version":"60cde8c6e76aa07d8f942c384b532ca01c14bcfde49561a6b17f95f9641d2dd8","signature":"05232bf12123918b55128f74d7534831fea94983e8766b0cd8e9b2247e70217b"},"d85b5e32ca34d125815d0e875f6839d73215768c90b7482fddd610eef622e168",{"version":"cc21a3b21e2f8f35dd8f90d28b6060a6c7bd1a72b99a77ec0556b519a7a73934","signature":"a8040c10d140be3f94f7bc993b29f8f7e34f56b5042b580ed8ca7a984fe95627"},"ab46309b639fb01d162488e25afc36bf4a8da3ab37f09a6dc70c733a5b9829ba",{"version":"2f43d2ff5bc86c1612b2b8cc88095688d51107539a77c67a7d132814d482c06c","signature":"a14188d445479722060109930b6f38281cf57d2b370b6f3c4d89442504f3bed7"},{"version":"94e8eae7586e7b256cb3a0e266a0fb71d5307c542243963fad5f52c91ac40aa8","signature":"0ad7a2b067566d9ece83849e37f792792be0632809ccd3dc7eb0f44f82d40bd0"},{"version":"e260d3a5275e3b54fa5373f48ea39b3b4c876bbecfa09b0dc19d5dce2d311a2e","signature":"8e609bb71c20b858c77f0e9f90bb1319db8477b13f9f965f1a1e18524bf50881"},{"version":"62e1bf47389b38255f5b77d5548e6983ee192a1bb2254bcd6c0333fc2ef13c34","signature":"da51336066b98b8b26a64d60f4185a10a801c71dc02c9065f8f90127e8813ce0"},"4d2aefa43e03d5a32d161ab91ed6c34a83c31573d107f6c2f503269552760727",{"version":"3e6239b7b45d4c78f745b459e3a8493af4be6a5fc078cbc6c471d5db77902a06","signature":"200426c8d87ae866a7eb0e9ce577ebd7b9437df0f4d166965840e01e96144eff"},{"version":"0f2ac3e73064d6a8ec7f3ef8c726ecc9bd2cc34045cf18b2ec8142790d75bbe7","signature":"55216b3caf3325c8aa65aab47b84e826fca2bb492e229733d5599cc2ba4958fe"},"efbcd0db768c8811b991e8b20165035182beb666381ff1db7044b4119aba5ee3","c401118ea6c6daa9f196013b0622c602d4faec565bb1cc6ca751d2a8fc295498","0359682c54e487c4cab2b53b2b4d35cc8dea4d9914bc6abcdb5701f8b8e745a4","7e771891adaa85b690266bc37bd6eb43bc57eecc4b54693ead36467e7369952a","a69c09dbea52352f479d3e7ac949fde3d17b195abe90b045d619f747b38d6d1a",{"version":"ca72190df0eb9b09d4b600821c8c7b6c9747b75a1c700c4d57dc0bb72abc074c","affectsGlobalScope":true},"21a167fec8f933752fb8157f06d28fab6817af3ad9b0bdb1908a10762391eab9",{"version":"bb65c6267c5d6676be61acbf6604cf0a4555ac4b505df58ac15c831fcbff4e3e","affectsGlobalScope":true},"374ca798f244e464346f14301dc2a8b4b111af1a83b49fffef5906c338a1f922","5a94487653355b56018122d92392beb2e5f4a6c63ba5cef83bbe1c99775ef713",{"version":"d5135ad93b33adcce80b18f8065087934cdc1730d63db58562edcf017e1aad9b","affectsGlobalScope":true},"82408ed3e959ddc60d3e9904481b5a8dc16469928257af22a3f7d1a3bc7fd8c4","dab86d9604fe40854ef3c0a6f9e8948873dc3509213418e5e457f410fd11200f","bb9c4ffa5e6290c6980b63c815cdd1625876dadb2efaf77edbe82984be93e55e","489532ff54b714f0e0939947a1c560e516d3ae93d51d639ab02e907a0e950114","f30bb836526d930a74593f7b0f5c1c46d10856415a8f69e5e2fc3db80371e362","14b5aa23c5d0ae1907bc696ac7b6915d88f7d85799cc0dc2dcf98fbce2c5a67c","5c439dafdc09abe4d6c260a96b822fa0ba5be7203c71a63ab1f1423cd9e838ea",{"version":"6b526a5ec4a401ca7c26cfe6a48e641d8f30af76673bad3b06a1b4504594a960","affectsGlobalScope":true},{"version":"816ad2e607a96de5bcac7d437f843f5afd8957f1fa5eefa6bba8e4ed7ca8fd84","affectsGlobalScope":true},"cec36af22f514322f870e81d30675c78df82ae8bf4863f5fd4e4424c040c678d","d903fafe96674bc0b2ac38a5be4a8fc07b14c2548d1cdb165a80ea24c44c0c54","5eec82ac21f84d83586c59a16b9b8502d34505d1393393556682fe7e7fde9ef2","04eb6578a588d6a46f50299b55f30e3a04ef27d0c5a46c57d8fcc211cd530faa","8d3c583a07e0c37e876908c2d5da575019f689df8d9fa4c081d99119d53dba22","2c828a5405191d006115ab34e191b8474bc6c86ffdc401d1a9864b1b6e088a58",{"version":"e8b18c6385ff784228a6f369694fcf1a6b475355ba89090a88de13587a9391d5","affectsGlobalScope":true},"d076fede3cb042e7b13fc29442aaa03a57806bc51e2b26a67a01fbc66a7c0c12","7c013aa892414a7fdcfd861ae524a668eaa3ede8c7c0acafaf611948122c8d93","b0973c3cbcdc59b37bf477731d468696ecaf442593ec51bab497a613a580fe30",{"version":"4989e92ba5b69b182d2caaea6295af52b7dc73a4f7a2e336a676722884e7139d","affectsGlobalScope":true},{"version":"b3624aed92dab6da8484280d3cb3e2f4130ec3f4ef3f8201c95144ae9e898bb6","affectsGlobalScope":true},"5153a2fd150e46ce57bb3f8db1318d33f6ad3261ed70ceeff92281c0608c74a3","210d54cd652ec0fec8c8916e4af59bb341065576ecda039842f9ffb2e908507c","36b03690b628eab08703d63f04eaa89c5df202e5f1edf3989f13ad389cd2c091","0effadd232a20498b11308058e334d3339cc5bf8c4c858393e38d9d4c0013dcf","25846d43937c672bab7e8195f3d881f93495df712ee901860effc109918938cc","fd93cee2621ff42dabe57b7be402783fd1aa69ece755bcba1e0290547ae60513","1b952304137851e45bc009785de89ada562d9376177c97e37702e39e60c2f1ff","69ee23dd0d215b09907ad30d23f88b7790c93329d1faf31d7835552a10cf7cbf","44b8b584a338b190a59f4f6929d072431950c7bd92ec2694821c11bce180c8a5","23b89798789dffbd437c0c423f5d02d11f9736aea73d6abf16db4f812ff36eda","223c37f62ce09a3d99e77498acdee7b2705a4ae14552fbdb4093600cd9164f3f",{"version":"970a90f76d4d219ad60819d61f5994514087ba94c985647a3474a5a3d12714ed","affectsGlobalScope":true},"e10177274a35a9d07c825615340b2fcde2f610f53f3fb40269fd196b4288dda6","4c8525f256873c7ba3135338c647eaf0ca7115a1a2805ae2d0056629461186ce","3c13ef48634e7b5012fcf7e8fce7496352c2d779a7201389ca96a2a81ee4314d","5d0a25ec910fa36595f85a67ac992d7a53dd4064a1ba6aea1c9f14ab73a023f2",{"version":"f0900cd5d00fe1263ff41201fb8073dbeb984397e4af3b8002a5c207a30bdc33","affectsGlobalScope":true},{"version":"4c50342e1b65d3bee2ed4ab18f84842d5724ad11083bd666d8705dc7a6079d80","affectsGlobalScope":true},"06d7c42d256f0ce6afe1b2b6cfbc97ab391f29dadb00dd0ae8e8f23f5bc916c3","ec4bd1b200670fb567920db572d6701ed42a9641d09c4ff6869768c8f81b404c","e59a892d87e72733e2a9ca21611b9beb52977be2696c7ba4b216cbbb9a48f5aa",{"version":"da26af7362f53d122283bc69fed862b9a9fe27e01bc6a69d1d682e0e5a4df3e6","affectsGlobalScope":true},"8a300fa9b698845a1f9c41ecbe2c5966634582a8e2020d51abcace9b55aa959e",{"version":"ab9b9a36e5284fd8d3bf2f7d5fcbc60052f25f27e4d20954782099282c60d23e","affectsGlobalScope":true},"8dbe725f8d237e70310977afcfa011629804d101ebaa0266cafda6b61ad72236","2b8264b2fefd7367e0f20e2c04eed5d3038831fe00f5efbc110ff0131aab899b"],"root":[[45,85]],"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":[[134],[88,134],[91,134],[92,97,125,134],[93,104,105,112,122,133,134],[93,94,104,112,134],[95,134],[96,97,105,113,134],[97,122,130,134],[98,100,104,112,134],[99,134],[100,101,134],[104,134],[102,104,134],[104,105,106,122,133,134],[104,105,106,119,122,125,134],[134,138],[100,107,112,122,133,134],[104,105,107,108,112,122,130,133,134],[107,109,122,130,133,134],[88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140],[104,110,134],[111,133,134],[100,104,112,122,134],[113,134],[114,134],[91,115,134],[116,132,134,138],[117,134],[118,134],[104,119,120,134],[119,121,134,136],[92,104,122,123,124,125,134],[92,122,124,134],[122,123,134],[125,134],[126,134],[104,128,129,134],[128,129,134],[97,112,122,130,134],[131,134],[112,132,134],[92,107,118,133,134],[97,134],[122,134,135],[134,136],[134,137],[92,97,104,106,115,122,133,134,136,138],[122,134,139],[45,46,134],[46,134],[51,134],[53,134],[47,60,62,134],[47,48,49,50,51,52,53,54,55,56,57,58,59,61,63,64,65,66,67,68,69,70,71,72,73,74,134],[60,134],[62,77,78,79,81,134],[61,63,134],[80,134],[105,114,134],[45,46,80,83,84,134],[59,134],[45,46],[46],[51],[53],[47],[80]],"referencedMap":[[86,1],[87,1],[88,2],[89,2],[91,3],[92,4],[93,5],[94,6],[95,7],[96,8],[97,9],[98,10],[99,11],[100,12],[101,12],[103,13],[102,14],[104,13],[105,15],[106,16],[90,17],[140,1],[107,18],[108,19],[109,20],[141,21],[110,22],[111,23],[112,24],[113,25],[114,26],[115,27],[116,28],[117,29],[118,30],[119,31],[120,31],[121,32],[122,33],[124,34],[123,35],[125,36],[126,37],[127,1],[128,38],[129,39],[130,40],[131,41],[132,42],[133,43],[134,44],[135,45],[136,46],[137,47],[138,48],[139,49],[142,1],[43,1],[44,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[33,1],[30,1],[31,1],[32,1],[34,1],[7,1],[35,1],[40,1],[41,1],[36,1],[37,1],[38,1],[39,1],[1,1],[42,1],[47,50],[48,51],[49,1],[50,1],[52,52],[51,1],[53,1],[54,53],[55,1],[56,1],[57,1],[58,1],[63,54],[64,1],[65,1],[66,1],[59,1],[75,55],[61,56],[70,1],[67,1],[77,1],[78,1],[79,1],[82,57],[62,58],[81,59],[73,1],[71,1],[72,1],[68,1],[76,1],[80,1],[46,1],[45,1],[83,60],[85,61],[84,1],[69,1],[74,1],[60,62]],"exportedModulesMap":[[86,1],[87,1],[88,2],[89,2],[91,3],[92,4],[93,5],[94,6],[95,7],[96,8],[97,9],[98,10],[99,11],[100,12],[101,12],[103,13],[102,14],[104,13],[105,15],[106,16],[90,17],[140,1],[107,18],[108,19],[109,20],[141,21],[110,22],[111,23],[112,24],[113,25],[114,26],[115,27],[116,28],[117,29],[118,30],[119,31],[120,31],[121,32],[122,33],[124,34],[123,35],[125,36],[126,37],[127,1],[128,38],[129,39],[130,40],[131,41],[132,42],[133,43],[134,44],[135,45],[136,46],[137,47],[138,48],[139,49],[142,1],[43,1],[44,1],[8,1],[10,1],[9,1],[2,1],[11,1],[12,1],[13,1],[14,1],[15,1],[16,1],[17,1],[18,1],[3,1],[4,1],[22,1],[19,1],[20,1],[21,1],[23,1],[24,1],[25,1],[5,1],[26,1],[27,1],[28,1],[29,1],[6,1],[33,1],[30,1],[31,1],[32,1],[34,1],[7,1],[35,1],[40,1],[41,1],[36,1],[37,1],[38,1],[39,1],[1,1],[42,1],[47,63],[48,64],[50,1],[52,65],[54,66],[63,67],[75,55],[77,1],[82,57],[81,68],[85,61]],"semanticDiagnosticsPerFile":[86,87,88,89,91,92,93,94,95,96,97,98,99,100,101,103,102,104,105,106,90,140,107,108,109,141,110,111,112,113,114,115,116,117,118,119,120,121,122,124,123,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,142,43,44,8,10,9,2,11,12,13,14,15,16,17,18,3,4,22,19,20,21,23,24,25,5,26,27,28,29,6,33,30,31,32,34,7,35,40,41,36,37,38,39,1,42,47,48,49,50,52,51,53,54,55,56,57,58,63,64,65,66,59,75,61,70,67,77,78,79,82,62,81,73,71,72,68,76,80,46,45,83,85,84,69,74,60]},"version":"5.0.4"} \ No newline at end of file diff --git a/typeGuard.d.ts b/typeGuard.d.ts new file mode 100644 index 0000000..e5924e2 --- /dev/null +++ b/typeGuard.d.ts @@ -0,0 +1,2 @@ +/** https://docs.tsafe.dev/typeguard */ +export declare function typeGuard(_value: any, isMatched: boolean): _value is T; diff --git a/typeGuard.js b/typeGuard.js new file mode 100644 index 0000000..f791f45 --- /dev/null +++ b/typeGuard.js @@ -0,0 +1,11 @@ +"use strict"; +/* eslint-disable @typescript-eslint/no-namespace */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.typeGuard = void 0; +/** https://docs.tsafe.dev/typeguard */ +function typeGuard(_value, isMatched) { + return isMatched; +} +exports.typeGuard = typeGuard; +//# sourceMappingURL=typeGuard.js.map \ No newline at end of file diff --git a/typeGuard.js.map b/typeGuard.js.map new file mode 100644 index 0000000..7cca5b8 --- /dev/null +++ b/typeGuard.js.map @@ -0,0 +1 @@ +{"version":3,"file":"typeGuard.js","sourceRoot":"","sources":["src/typeGuard.ts"],"names":[],"mappings":";AAAA,oDAAoD;AACpD,uDAAuD;;;AAEvD,uCAAuC;AACvC,SAAgB,SAAS,CAAI,MAAW,EAAE,SAAkB;IACxD,OAAO,SAAS,CAAC;AACrB,CAAC;AAFD,8BAEC"} \ No newline at end of file diff --git a/uncapitalize.d.ts b/uncapitalize.d.ts new file mode 100644 index 0000000..1496b91 --- /dev/null +++ b/uncapitalize.d.ts @@ -0,0 +1,2 @@ +/** @see */ +export declare function uncapitalize(str: S): Uncapitalize; diff --git a/uncapitalize.js b/uncapitalize.js new file mode 100644 index 0000000..e0e25ce --- /dev/null +++ b/uncapitalize.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.uncapitalize = void 0; +/** @see */ +function uncapitalize(str) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return (str.charAt(0).toLowerCase() + str.slice(1)); +} +exports.uncapitalize = uncapitalize; +//# sourceMappingURL=uncapitalize.js.map \ No newline at end of file diff --git a/uncapitalize.js.map b/uncapitalize.js.map new file mode 100644 index 0000000..ac4ea17 --- /dev/null +++ b/uncapitalize.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uncapitalize.js","sourceRoot":"","sources":["src/uncapitalize.ts"],"names":[],"mappings":";;;AAAA,4DAA4D;AAC5D,SAAgB,YAAY,CAAmB,GAAM;IACjD,8DAA8D;IAC9D,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAQ,CAAC;AAC/D,CAAC;AAHD,oCAGC"} \ No newline at end of file diff --git a/zz_internal/assertIsRefWrapper.d.ts b/zz_internal/assertIsRefWrapper.d.ts new file mode 100644 index 0000000..443d0e1 --- /dev/null +++ b/zz_internal/assertIsRefWrapper.d.ts @@ -0,0 +1,3 @@ +export declare const assertIsRefWrapper: { + ref: Record | undefined; +}; diff --git a/zz_internal/assertIsRefWrapper.js b/zz_internal/assertIsRefWrapper.js new file mode 100644 index 0000000..3db8e05 --- /dev/null +++ b/zz_internal/assertIsRefWrapper.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.assertIsRefWrapper = void 0; +var id_1 = require("../id"); +exports.assertIsRefWrapper = { + "ref": (0, id_1.id)(undefined), +}; +//# sourceMappingURL=assertIsRefWrapper.js.map \ No newline at end of file diff --git a/zz_internal/assertIsRefWrapper.js.map b/zz_internal/assertIsRefWrapper.js.map new file mode 100644 index 0000000..7e3e5c5 --- /dev/null +++ b/zz_internal/assertIsRefWrapper.js.map @@ -0,0 +1 @@ +{"version":3,"file":"assertIsRefWrapper.js","sourceRoot":"","sources":["../src/zz_internal/assertIsRefWrapper.ts"],"names":[],"mappings":";;;AAAA,4BAA2B;AAEd,QAAA,kBAAkB,GAAG;IAC9B,KAAK,EAAE,IAAA,OAAE,EAAoC,SAAS,CAAC;CAC1D,CAAC"} \ No newline at end of file