From 85047af60123a232057f4b6b875609f837e668d0 Mon Sep 17 00:00:00 2001 From: Adam Avramov Date: Wed, 8 Nov 2023 20:08:35 +0200 Subject: [PATCH] wip: refactor(ptop): unify allo/hide/into/many/over into prop --- allo/.gitignore | 1 - allo/.npmignore | 1 - allo/allo.d.ts | 22 ---------------------- allo/package.json | 26 -------------------------- allo/tsconfig.json | 1 - hide/.gitignore | 1 - hide/README.md | 9 --------- hide/hide.d.ts | 3 --- hide/package.json | 29 ----------------------------- hide/tsconfig.json | 1 - into/README.md | 9 --------- into/package.json | 21 --------------------- into/tsconfig.json | 5 ----- many/README.md | 9 --------- many/package.json | 21 --------------------- many/tsconfig.json | 2 -- over/README.md | 9 --------- over/package.json | 21 --------------------- over/tsconfig.json | 5 ----- {allo => prop}/README.md | 0 {allo => prop}/allo.cjs | 0 {allo => prop}/allo.mjs | 0 {allo => prop}/allo.spec.ts.md | 0 {allo => prop}/allo.test.ts | 0 {allo => prop}/allo.ts | 0 {hide => prop}/hide.cjs | 0 {hide => prop}/hide.mjs | 0 {into => prop}/into.ts | 0 {many => prop}/many.ts | 0 {over => prop}/over.ts | 0 prop/prop-allo.mjs | 0 prop/prop-hide.mjs | 0 prop/prop-into.mjs | 0 prop/prop-many.mjs | 0 prop/prop-over.mjs | 0 prop/prop-pick.mjs | 0 prop/prop.cjs | 3 +++ prop/tsconfig.json | 1 + 38 files changed, 4 insertions(+), 196 deletions(-) delete mode 100644 allo/.gitignore delete mode 100644 allo/.npmignore delete mode 100644 allo/allo.d.ts delete mode 100644 allo/package.json delete mode 100644 allo/tsconfig.json delete mode 100644 hide/.gitignore delete mode 100644 hide/README.md delete mode 100644 hide/hide.d.ts delete mode 100644 hide/package.json delete mode 100644 hide/tsconfig.json delete mode 100644 into/README.md delete mode 100644 into/package.json delete mode 100644 into/tsconfig.json delete mode 100644 many/README.md delete mode 100644 many/package.json delete mode 100644 many/tsconfig.json delete mode 100644 over/README.md delete mode 100644 over/package.json delete mode 100644 over/tsconfig.json rename {allo => prop}/README.md (100%) rename {allo => prop}/allo.cjs (100%) rename {allo => prop}/allo.mjs (100%) rename {allo => prop}/allo.spec.ts.md (100%) rename {allo => prop}/allo.test.ts (100%) rename {allo => prop}/allo.ts (100%) rename {hide => prop}/hide.cjs (100%) rename {hide => prop}/hide.mjs (100%) rename {into => prop}/into.ts (100%) rename {many => prop}/many.ts (100%) rename {over => prop}/over.ts (100%) delete mode 100644 prop/prop-allo.mjs delete mode 100644 prop/prop-hide.mjs delete mode 100644 prop/prop-into.mjs delete mode 100644 prop/prop-many.mjs delete mode 100644 prop/prop-over.mjs delete mode 100644 prop/prop-pick.mjs create mode 100644 prop/tsconfig.json diff --git a/allo/.gitignore b/allo/.gitignore deleted file mode 100644 index f955bf36..00000000 --- a/allo/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!*.d.ts diff --git a/allo/.npmignore b/allo/.npmignore deleted file mode 100644 index 9db08315..00000000 --- a/allo/.npmignore +++ /dev/null @@ -1 +0,0 @@ -*.test.* diff --git a/allo/allo.d.ts b/allo/allo.d.ts deleted file mode 100644 index fb20eff8..00000000 --- a/allo/allo.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -/** Define a callable class. Instances of the generated class can be invoked as functions. - * The body of the function is passed as second argument. - * The function's `this` identifier is bound to the instance. - * @returns a callable class extending `Base`. */ -export function defineCallable < - F extends Function, - A extends unknown[], - T, - U extends T -> ( - /** The function that will be invoked when calling the instance. */ - fn: F, - /** The base class to be made callable. */ - Base?: Class -): - Class - -type Class = - new (...args: A) => T - -export function rebind (target: object, source: object): - typeof target diff --git a/allo/package.json b/allo/package.json deleted file mode 100644 index 9dfc6430..00000000 --- a/allo/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "@hackbg/allo", - "version": "1.0.2", - "main": "allo.mjs", - "types": "allo.d.ts", - "type": "module", - "exports": { - "import": "./allo.mjs", - "require": "./allo.cjs" - }, - "homepage": "https://github.com/hackbg/toolbox", - "bugs": "https://github.com/hackbg/toolbox/issues", - "repository": {"type": "git", "url": "https://github.com/hackbg/toolbox", "directory": "allo"}, - "license": "MIT", - "description": "Make objects callable.", - "files": [ "README.md", "allo.mjs", "allo.cjs", "allo.ts", "allo.d.ts" ], - "devDependencies": { - "@hackbg/ganesha": "^4.2" - }, - "scripts": { - "ubik": "npm test && npm run check && ubik", - "test": "true || ganesha-node allo.spec.ts.md", - "check": "tsc --noEmit", - "clean": "ubik clean && rm -rf dist types *.dist.*" - } -} diff --git a/allo/tsconfig.json b/allo/tsconfig.json deleted file mode 100644 index c269685d..00000000 --- a/allo/tsconfig.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "../tsconfig.json", "include": [ "allo.ts", "allo.test.ts" ] } diff --git a/hide/.gitignore b/hide/.gitignore deleted file mode 100644 index 9d6a5952..00000000 --- a/hide/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!hide.d.ts diff --git a/hide/README.md b/hide/README.md deleted file mode 100644 index b9d34dad..00000000 --- a/hide/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# @hackbg/hide - -
- ---- - -Made with **#%&!** @ [**Hack.bg**](https://foss.hack.bg) - -
diff --git a/hide/hide.d.ts b/hide/hide.d.ts deleted file mode 100644 index 5d926501..00000000 --- a/hide/hide.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/** Hide properties by redefining them as non-enumerable. - * @returns the first argument */ -export function hideProperties (self: T, ...keys: string[]): T diff --git a/hide/package.json b/hide/package.json deleted file mode 100644 index 6208d3c0..00000000 --- a/hide/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "@hackbg/hide", - "version": "1.0.3", - "main": "hide.js", - "types": "hide.d.ts", - "type": "module", - "exports": { - ".": { - "import": "./hide.mjs", - "require": "./hide.cjs" - }, - "./hide.cjs": "./hide.cjs" - }, - "homepage": "https://github.com/hackbg/toolbox", - "bugs": "https://github.com/hackbg/toolbox/issues", - "repository": {"type": "git", "url": "https://github.com/hackbg/toolbox", "directory": "hide"}, - "license": "MIT", - "description": "Redefine object properties as non-enumerable.", - "files": [ "README.md", "hide.ts", "hide.cjs", "hide.d.ts", "hide.mjs" ], - "devDependencies": { - "@hackbg/ganesha": "^4.2" - }, - "scripts": { - "ubik": "npm test && npm run check && ubik", - "test": "true || ganesha-node README.md", - "check": "true", - "clean": "ubik clean && rm -rf dist types *.dist.*" - } -} diff --git a/hide/tsconfig.json b/hide/tsconfig.json deleted file mode 100644 index a6f51619..00000000 --- a/hide/tsconfig.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "../tsconfig.json", "include": [ "hide.ts" ] } diff --git a/into/README.md b/into/README.md deleted file mode 100644 index 32bd2dc1..00000000 --- a/into/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# @hackbg/into - -
- ---- - -Made with **#%&!** @ [**Hack.bg**](https://foss.hack.bg) - -
diff --git a/into/package.json b/into/package.json deleted file mode 100644 index 3a8b30c8..00000000 --- a/into/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "@hackbg/into", - "version": "1.0.1", - "main": "into.ts", - "type": "module", - "homepage": "https://github.com/hackbg/toolbox", - "bugs": "https://github.com/hackbg/toolbox/issues", - "repository": {"type": "git", "url": "https://github.com/hackbg/toolbox", "directory": "into"}, - "license": "MIT", - "description": "Resolve partially asynchronous values and collections.", - "files": [ "README.md", "into.ts" ], - "devDependencies": { - "@hackbg/ganesha": "^4.2" - }, - "scripts": { - "ubik": "npm test && npm run check && ubik", - "test": "true || ganesha-node into.spec.ts.md", - "check": "tsc --noEmit", - "clean": "ubik clean && rm -rf dist types *.dist.*" - } -} diff --git a/into/tsconfig.json b/into/tsconfig.json deleted file mode 100644 index 617fe1ec..00000000 --- a/into/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "../tsconfig.json", - "include": [ "*.ts" ], - "exclude": ["dist/"] -} diff --git a/many/README.md b/many/README.md deleted file mode 100644 index d20e04e3..00000000 --- a/many/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# @hackbg/many - -
- ---- - -Made with **#%&!** @ [**Hack.bg**](https://foss.hack.bg) - -
diff --git a/many/package.json b/many/package.json deleted file mode 100644 index cd2152e3..00000000 --- a/many/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "@hackbg/many", - "version": "1.0.0", - "main": "many.ts", - "type": "module", - "homepage": "https://github.com/hackbg/toolbox", - "bugs": "https://github.com/hackbg/toolbox/issues", - "repository": {"type": "git", "url": "https://github.com/hackbg/toolbox", "directory": "many"}, - "license": "MIT", - "description": "Generalized sync/async iteration over arrays/objects.", - "files": [ "README.md", "many.ts" ], - "devDependencies": { - "@hackbg/ganesha": "^4.2" - }, - "scripts": { - "ubik": "npm test && npm run check && ubik", - "test": "true || ganesha-node README.md", - "check": "tsc --noEmit", - "clean": "ubik clean && rm -rf dist types *.dist.*" - } -} diff --git a/many/tsconfig.json b/many/tsconfig.json deleted file mode 100644 index 2b3b3518..00000000 --- a/many/tsconfig.json +++ /dev/null @@ -1,2 +0,0 @@ -{ "extends": "../tsconfig.json", "include": [ "many.ts" ] } - diff --git a/over/README.md b/over/README.md deleted file mode 100644 index 78fc49fa..00000000 --- a/over/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# @hackbg/over - -
- ---- - -Made with **#%&!** @ [**Hack.bg**](https://foss.hack.bg) - -
diff --git a/over/package.json b/over/package.json deleted file mode 100644 index a0496d43..00000000 --- a/over/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "@hackbg/over", - "version": "1.1.0", - "main": "over.ts", - "type": "module", - "homepage": "https://github.com/hackbg/toolbox", - "bugs": "https://github.com/hackbg/toolbox/issues", - "repository": {"type": "git", "url": "https://github.com/hackbg/toolbox", "directory": "over"}, - "license": "MIT", - "description": "Implement overrides, fallbacks, and defaults.", - "files": [ "README.md", "over.ts" ], - "devDependencies": { - "@hackbg/ganesha": "^4.2" - }, - "scripts": { - "ubik": "npm test && npm run check && ubik", - "test": "true || ganesha-node over.spec.ts.md", - "check": "tsc --noEmit", - "clean": "ubik clean && rm -rf dist types *.dist.*" - } -} diff --git a/over/tsconfig.json b/over/tsconfig.json deleted file mode 100644 index 617fe1ec..00000000 --- a/over/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "../tsconfig.json", - "include": [ "*.ts" ], - "exclude": ["dist/"] -} diff --git a/allo/README.md b/prop/README.md similarity index 100% rename from allo/README.md rename to prop/README.md diff --git a/allo/allo.cjs b/prop/allo.cjs similarity index 100% rename from allo/allo.cjs rename to prop/allo.cjs diff --git a/allo/allo.mjs b/prop/allo.mjs similarity index 100% rename from allo/allo.mjs rename to prop/allo.mjs diff --git a/allo/allo.spec.ts.md b/prop/allo.spec.ts.md similarity index 100% rename from allo/allo.spec.ts.md rename to prop/allo.spec.ts.md diff --git a/allo/allo.test.ts b/prop/allo.test.ts similarity index 100% rename from allo/allo.test.ts rename to prop/allo.test.ts diff --git a/allo/allo.ts b/prop/allo.ts similarity index 100% rename from allo/allo.ts rename to prop/allo.ts diff --git a/hide/hide.cjs b/prop/hide.cjs similarity index 100% rename from hide/hide.cjs rename to prop/hide.cjs diff --git a/hide/hide.mjs b/prop/hide.mjs similarity index 100% rename from hide/hide.mjs rename to prop/hide.mjs diff --git a/into/into.ts b/prop/into.ts similarity index 100% rename from into/into.ts rename to prop/into.ts diff --git a/many/many.ts b/prop/many.ts similarity index 100% rename from many/many.ts rename to prop/many.ts diff --git a/over/over.ts b/prop/over.ts similarity index 100% rename from over/over.ts rename to prop/over.ts diff --git a/prop/prop-allo.mjs b/prop/prop-allo.mjs deleted file mode 100644 index e69de29b..00000000 diff --git a/prop/prop-hide.mjs b/prop/prop-hide.mjs deleted file mode 100644 index e69de29b..00000000 diff --git a/prop/prop-into.mjs b/prop/prop-into.mjs deleted file mode 100644 index e69de29b..00000000 diff --git a/prop/prop-many.mjs b/prop/prop-many.mjs deleted file mode 100644 index e69de29b..00000000 diff --git a/prop/prop-over.mjs b/prop/prop-over.mjs deleted file mode 100644 index e69de29b..00000000 diff --git a/prop/prop-pick.mjs b/prop/prop-pick.mjs deleted file mode 100644 index e69de29b..00000000 diff --git a/prop/prop.cjs b/prop/prop.cjs index e69de29b..84387f81 100644 --- a/prop/prop.cjs +++ b/prop/prop.cjs @@ -0,0 +1,3 @@ +module.exports.defineCallable = require('./allo.cjs').defineCallable +module.exports.rebind = require('./allo.cjs').rebind +module.exports.hide = require('./hide.cjs').hideProperties diff --git a/prop/tsconfig.json b/prop/tsconfig.json new file mode 100644 index 00000000..f4aa74f8 --- /dev/null +++ b/prop/tsconfig.json @@ -0,0 +1 @@ +{ "extends": "../tsconfig.json", "include": [ "*.ts" ] }