├── .nvmrc ├── utilities ├── curry │ ├── go │ │ └── .gitkeep │ ├── py │ │ ├── .gitkeep │ │ └── package.json │ ├── rust │ │ └── .gitkeep │ └── ts │ │ ├── CHANGELOG.md │ │ ├── tsconfig.json │ │ ├── src │ │ ├── index.test.ts │ │ └── index.ts │ │ ├── README.md │ │ └── package.json ├── head │ ├── go │ │ └── .gitkeep │ ├── py │ │ └── .gitkeep │ ├── rust │ │ └── .gitkeep │ └── ts │ │ ├── tsconfig.json │ │ ├── src │ │ ├── index.ts │ │ └── index.test.ts │ │ ├── README.md │ │ └── package.json ├── new-pkg │ ├── README.md │ ├── src │ │ ├── index.ts │ │ ├── types.ts │ │ ├── program.ts │ │ └── script.ts │ ├── pkg │ │ ├── tsconfig.json │ │ ├── src │ │ │ ├── index.test.ts │ │ │ └── index.ts │ │ ├── README.md │ │ └── pkg-package.json │ ├── tsconfig.json │ ├── package.json │ └── pnpm-lock.yaml ├── pipe │ ├── go │ │ └── .gitkeep │ ├── py │ │ └── .gitkeep │ ├── rust │ │ └── .gitkeep │ └── ts │ │ ├── tsconfig.json │ │ ├── src │ │ ├── index.test.ts │ │ └── index.ts │ │ ├── README.md │ │ └── package.json ├── repeat │ ├── go │ │ └── .gitkeep │ ├── py │ │ └── .gitkeep │ ├── rust │ │ └── .gitkeep │ └── ts │ │ ├── tsconfig.json │ │ ├── src │ │ ├── index.test.ts │ │ └── index.ts │ │ ├── README.md │ │ └── package.json ├── rot13 │ ├── go │ │ └── .gitkeep │ ├── py │ │ └── .gitkeep │ ├── rust │ │ └── .gitkeep │ └── ts │ │ ├── tsconfig.json │ │ ├── src │ │ ├── index.test.ts │ │ └── index.ts │ │ ├── README.md │ │ └── package.json ├── trace │ ├── go │ │ └── .gitkeep │ ├── py │ │ └── .gitkeep │ ├── rust │ │ └── .gitkeep │ └── ts │ │ ├── tsconfig.json │ │ ├── src │ │ ├── index.test.ts │ │ └── index.ts │ │ ├── README.md │ │ └── package.json ├── compose │ ├── go │ │ └── .gitkeep │ ├── py │ │ └── .gitkeep │ ├── rust │ │ └── .gitkeep │ └── ts │ │ ├── tsconfig.json │ │ ├── src │ │ ├── index.test.ts │ │ └── index.ts │ │ ├── README.md │ │ └── package.json ├── debounce │ ├── go │ │ └── .gitkeep │ ├── py │ │ └── .gitkeep │ ├── rust │ │ └── .gitkeep │ └── ts │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── src │ │ ├── index.ts │ │ └── index.test.ts │ │ └── package.json ├── is-object │ ├── go │ │ └── .gitkeep │ ├── py │ │ └── .gitkeep │ ├── rust │ │ └── .gitkeep │ └── ts │ │ ├── tsconfig.json │ │ ├── src │ │ ├── index.ts │ │ └── index.test.ts │ │ ├── README.md │ │ └── package.json ├── throttle │ ├── go │ │ └── .gitkeep │ ├── py │ │ └── .gitkeep │ ├── rust │ │ └── .gitkeep │ └── ts │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── src │ │ ├── index.ts │ │ └── index.test.ts │ │ └── package.json ├── filter-array │ ├── go │ │ └── .gitkeep │ ├── py │ │ └── .gitkeep │ ├── rust │ │ └── .gitkeep │ └── ts │ │ ├── tsconfig.json │ │ ├── src │ │ ├── index.test.ts │ │ └── index.ts │ │ ├── README.md │ │ └── package.json ├── merge-objects │ ├── go │ │ └── .gitkeep │ ├── py │ │ └── .gitkeep │ ├── rust │ │ └── .gitkeep │ └── ts │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── package.json │ │ └── src │ │ ├── index.ts │ │ └── index.test.ts ├── trim-whitespace │ ├── go │ │ └── .gitkeep │ ├── py │ │ └── .gitkeep │ ├── rust │ │ └── .gitkeep │ └── ts │ │ ├── tsconfig.json │ │ ├── src │ │ ├── index.ts │ │ └── index.test.ts │ │ ├── README.md │ │ └── package.json ├── kebab-to-camel-string │ ├── go │ │ └── .gitkeep │ ├── py │ │ └── .gitkeep │ ├── rust │ │ └── .gitkeep │ └── ts │ │ ├── tsconfig.json │ │ ├── src │ │ ├── index.test.ts │ │ └── index.ts │ │ ├── README.md │ │ └── package.json ├── snake-to-camel-case │ ├── go │ │ └── .gitkeep │ ├── py │ │ └── .gitkeep │ ├── rust │ │ └── .gitkeep │ └── ts │ │ ├── CHANGELOG.md │ │ ├── tsconfig.json │ │ ├── src │ │ ├── index.test.ts │ │ └── index.ts │ │ ├── README.md │ │ └── package.json ├── string-interpolation │ ├── go │ │ └── .gitkeep │ ├── py │ │ └── .gitkeep │ ├── rust │ │ └── .gitkeep │ └── ts │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── src │ │ ├── index.test.ts │ │ └── index.ts │ │ └── package.json ├── update-markdown-list │ ├── go │ │ └── .gitkeep │ ├── py │ │ └── .gitkeep │ ├── rust │ │ └── .gitkeep │ └── ts │ │ ├── tsconfig.json │ │ ├── README.md │ │ ├── package.json │ │ └── src │ │ ├── cli.ts │ │ ├── index.test.ts │ │ └── index.ts └── wait-until-defined │ ├── go │ └── .gitkeep │ ├── py │ └── .gitkeep │ ├── rust │ └── .gitkeep │ └── ts │ ├── tsconfig.json │ ├── README.md │ ├── package.json │ └── src │ ├── index.test.ts │ └── index.ts ├── .husky ├── pre-commit ├── commit-msg ├── post-merge ├── post-rewrite ├── post-checkout └── _ │ └── husky.sh ├── .gitattributes ├── .npmrc ├── pnpm-workspace.yaml ├── .changeset ├── shaggy-spies-bake.md ├── config.json └── README.md ├── .devcontainer ├── dockerfile └── devcontainer.json ├── turbo.json ├── .github ├── dependabot.yml ├── PULL_REQUEST_TEMPLATE.md ├── ISSUE_TEMPLATE.md └── workflows │ ├── codesee-arch-diagram.yml │ ├── nodejs.yml │ ├── update.yml │ └── codeql-analysis.yml ├── .kodiak.toml ├── eslint.config.mjs ├── .codependencerc ├── tsconfig.json ├── LICENSE ├── .gitignore ├── README.md └── package.json /.nvmrc: -------------------------------------------------------------------------------- 1 | 20 2 | -------------------------------------------------------------------------------- /utilities/curry/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/curry/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/head/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/head/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/head/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/new-pkg/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/pipe/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/pipe/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/pipe/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/repeat/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/repeat/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/rot13/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/rot13/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/trace/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/trace/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | pnpm test 2 | -------------------------------------------------------------------------------- /utilities/compose/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/compose/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/compose/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/curry/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/debounce/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/debounce/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/debounce/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/is-object/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/is-object/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/is-object/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/repeat/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/rot13/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/throttle/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/throttle/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/throttle/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/trace/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/filter-array/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/filter-array/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/filter-array/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/merge-objects/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/merge-objects/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/merge-objects/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/trim-whitespace/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/trim-whitespace/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/kebab-to-camel-string/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/kebab-to-camel-string/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/snake-to-camel-case/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/snake-to-camel-case/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/snake-to-camel-case/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/string-interpolation/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/string-interpolation/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/trim-whitespace/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/update-markdown-list/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/update-markdown-list/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/wait-until-defined/go/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/wait-until-defined/py/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/wait-until-defined/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/kebab-to-camel-string/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/string-interpolation/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /utilities/update-markdown-list/rust/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.ts linguist-language=TypeScript 2 | -------------------------------------------------------------------------------- /.husky/commit-msg: -------------------------------------------------------------------------------- 1 | pnpm dlx commitlint --edit $1 2 | -------------------------------------------------------------------------------- /.npmrc: -------------------------------------------------------------------------------- 1 | link-workspace-packages=false 2 | strict-peer-dependencies=false 3 | -------------------------------------------------------------------------------- /pnpm-workspace.yaml: -------------------------------------------------------------------------------- 1 | packages: 2 | - 'utilities/*' 3 | - 'utilities/*/ts' 4 | -------------------------------------------------------------------------------- /.husky/post-merge: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | pnpm install -r 5 | -------------------------------------------------------------------------------- /.husky/post-rewrite: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | pnpm install -r 5 | -------------------------------------------------------------------------------- /.husky/post-checkout: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | if [[ $HUSKY_GIT_PARAMS =~ 1$ ]]; then pnpm install -r; fi 5 | -------------------------------------------------------------------------------- /utilities/curry/ts/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @common-utilities/curry 2 | 3 | ## 0.1.0 4 | 5 | ### Minor Changes 6 | 7 | - Adds initial work for curry & snake-to-camel-case 8 | -------------------------------------------------------------------------------- /.changeset/shaggy-spies-bake.md: -------------------------------------------------------------------------------- 1 | --- 2 | "@common-utilities/curry": patch 3 | "@common-utilities/snake-to-camel-case": patch 4 | --- 5 | 6 | feat(root): adds changesets 7 | -------------------------------------------------------------------------------- /.devcontainer/dockerfile: -------------------------------------------------------------------------------- 1 | ARG VARIANT="18-bullseye" 2 | FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT} 3 | RUN su node -c "npm install -g pnpm" 4 | -------------------------------------------------------------------------------- /utilities/new-pkg/src/index.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | import program from "./program"; 4 | import { script } from "./script"; 5 | 6 | program; 7 | 8 | export { program, script }; 9 | -------------------------------------------------------------------------------- /utilities/snake-to-camel-case/ts/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # @common-utilities/snake-to-camel-case 2 | 3 | ## 0.1.0 4 | 5 | ### Minor Changes 6 | 7 | - Adds initial work for curry & snake-to-camel-case 8 | -------------------------------------------------------------------------------- /utilities/curry/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /utilities/new-pkg/pkg/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /.husky/_/husky.sh: -------------------------------------------------------------------------------- 1 | echo "husky - DEPRECATED 2 | 3 | Please remove the following two lines from $0: 4 | 5 | #!/usr/bin/env sh 6 | . \"\$(dirname -- \"\$0\")/_/husky.sh\" 7 | 8 | They WILL FAIL in v10.0.0 9 | " -------------------------------------------------------------------------------- /utilities/snake-to-camel-case/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "include": ["src"] 8 | } 9 | -------------------------------------------------------------------------------- /turbo.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://turbo.build/schema.json", 3 | "pipeline": { 4 | "build": { 5 | "inputs": ["**/*.ts", "**/*.tsx", "!**/*.test.ts", "!**/*.test.tsx"] 6 | }, 7 | "clean": {} 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: npm 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | time: "13:00" 8 | open-pull-requests-limit: 2 9 | ignore: 10 | - dependency-name: "husky" 11 | -------------------------------------------------------------------------------- /utilities/compose/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "exclude": ["src/*.test.ts", "*.js"], 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /utilities/debounce/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "exclude": ["src/*.test.ts", "*.js"], 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /utilities/head/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "exclude": ["src/*.test.ts", "*.js"], 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /utilities/pipe/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "exclude": ["src/*.test.ts", "*.js"], 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /utilities/repeat/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "exclude": ["src/*.test.ts", "*.js"], 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /utilities/rot13/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "exclude": ["src/*.test.ts", "*.js"], 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /utilities/throttle/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "exclude": ["src/*.test.ts", "*.js"], 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /utilities/trace/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "exclude": ["src/*.test.ts", "*.js"], 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /utilities/filter-array/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "exclude": ["src/*.test.ts", "*.js"], 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /utilities/is-object/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "exclude": ["src/*.test.ts", "*.js"], 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /utilities/merge-objects/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "exclude": ["src/*.test.ts", "*.js"], 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /utilities/new-pkg/pkg/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import name from "./index"; 2 | 3 | describe("@common-utilities/name", () => { 4 | it("it does something", () => { 5 | const result = typeof name === "function"; 6 | expect(result).toBeTruthy(); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /utilities/trim-whitespace/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "exclude": ["src/*.test.ts", "*.js"], 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /utilities/wait-until-defined/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "exclude": ["src/*.test.ts", "*.js"], 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /.kodiak.toml: -------------------------------------------------------------------------------- 1 | # .kodiak.toml 2 | # Minimal config. version is the only required field. 3 | version = 1 4 | auto_approve_usernames = ["dependabot"] 5 | merge.automerge_label = ['dependencies','automerge 🚀'] 6 | update.autoupdate_labels = ['dependencies','autoupdate 🔁'] 7 | -------------------------------------------------------------------------------- /utilities/kebab-to-camel-string/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "exclude": ["src/*.test.ts", "*.js"], 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /utilities/string-interpolation/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src" 6 | }, 7 | "exclude": ["src/*.test.ts", "*.js"], 8 | "include": ["src"] 9 | } 10 | -------------------------------------------------------------------------------- /utilities/new-pkg/pkg/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * NAME 3 | * ---- 4 | * DESCRIPTION 5 | * ---- 6 | * @param {array} 7 | * @returns {item} returns the first item of an array 8 | */ 9 | export const name = ([first]: unknown[]): unknown => first; 10 | 11 | export default name; 12 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Fixes 2 | 3 | - Fixes # 4 | 5 | ## Proposed Changes 6 | 7 | - Change 8 | 9 | ---- 10 | 11 | > Read about referenced issues [here](https://help.github.com/articles/closing-issues-using-keywords/). Replace words with this Pull Request's context. 12 | -------------------------------------------------------------------------------- /utilities/new-pkg/src/types.ts: -------------------------------------------------------------------------------- 1 | export type InputOptions = { 2 | name?: string; 3 | message?: string; 4 | }; 5 | 6 | export type Input = { 7 | name: string; 8 | }; 9 | 10 | export type Options = { 11 | description?: string; 12 | name?: string; 13 | pkgType?: string; 14 | }; 15 | -------------------------------------------------------------------------------- /utilities/trace/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import trace from "./index"; 2 | 3 | describe("@common-utilities/", () => { 4 | describe("trace", () => { 5 | test("it traces", () => { 6 | const result = trace("number")(2); 7 | expect(result).toEqual(2); 8 | }); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Node.js", 3 | "build": { 4 | "dockerfile": "Dockerfile", 5 | "args": { "VARIANT": "18-bullseye" } 6 | }, 7 | "extensions": [ 8 | "dbaeumer.vscode-eslint" 9 | ], 10 | "postCreateCommand": "pnpm install", 11 | "remoteUser": "node" 12 | } 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Requested Update 2 | 3 | ## Why Is This Update Needed? 4 | 5 | ## Are There Examples Of This Requested Update Elsewhere? 6 | 7 | > Read about references issues [here](https://help.github.com/articles/closing-issues-using-keywords/). Provide paragraph text responses to each header. 8 | -------------------------------------------------------------------------------- /utilities/head/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * head 👤 3 | * ---- 4 | * A common utility returning the first item in an array 5 | * ---- 6 | * @param {array} 7 | * @returns {item} returns the first item of an array 8 | */ 9 | export const head = ([first]: unknown[]): unknown => first; 10 | 11 | export default head; 12 | -------------------------------------------------------------------------------- /utilities/update-markdown-list/ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src", 6 | "module": "ESNext", 7 | "target": "ES2022", 8 | "lib": ["ES2022", "DOM"], 9 | "moduleResolution": "node" 10 | }, 11 | "include": ["src"] 12 | } 13 | -------------------------------------------------------------------------------- /utilities/rot13/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import rot13 from "./index"; 2 | 3 | describe("@common-utilities/", () => { 4 | describe("rot13", () => { 5 | test("it encryptes", () => { 6 | const result = rot13("Hello Rot13 is awesome!"); 7 | expect(result).toEqual("Uryyb Ebg13 vf njrfbzr!"); 8 | }); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /utilities/trim-whitespace/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | export const removeWhitespaceFromString = (string: string): string => 2 | string 3 | .trim() 4 | .split(" ") 5 | .map((word: string): string => word.trim()) 6 | .filter((word: string): boolean => word !== "") 7 | .join(" "); 8 | 9 | export default removeWhitespaceFromString; 10 | -------------------------------------------------------------------------------- /utilities/repeat/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import repeat from "./index"; 2 | 3 | describe("@common-utilities/", () => { 4 | describe("repeat", () => { 5 | test("it repeats", () => { 6 | const add1 = (x: number): number => x + 1; 7 | const result = repeat(100)(add1)(0); 8 | expect(result).toEqual(100); 9 | }); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /utilities/is-object/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | export const isArray = (item: unknown): boolean => Array.isArray(item); 2 | 3 | export const isOfObjectType = (item: unknown): boolean => 4 | item !== null && typeof item === "object"; 5 | 6 | export const isObject = (item: unknown): boolean => 7 | isOfObjectType(item) && !isArray(item); 8 | 9 | export default isObject; 10 | -------------------------------------------------------------------------------- /utilities/new-pkg/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "./dist", 5 | "rootDir": "src", 6 | "module": "ESNext", 7 | "target": "ES2022", 8 | "lib": ["ES2022", "DOM"], 9 | "moduleResolution": "node" 10 | }, 11 | "exclude": ["pkg/**", "src/*.test.ts", "*.js"], 12 | "include": ["src"] 13 | } 14 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json", 3 | "changelog": "@changesets/cli/changelog", 4 | "commit": false, 5 | "fixed": [], 6 | "linked": [], 7 | "access": "restricted", 8 | "baseBranch": "master", 9 | "updateInternalDependencies": "patch", 10 | "ignore": ["@common-utilities/new-pkg"] 11 | } 12 | -------------------------------------------------------------------------------- /utilities/head/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import head from "./index"; 2 | 3 | describe("@common-utilities/", () => { 4 | describe("head", () => { 5 | test("it returns the first item (the head) of an array", () => { 6 | const input = Array.from(Array(10).keys()); 7 | const result = head(input); 8 | expect(result).toEqual(0); 9 | }); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /utilities/filter-array/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import filterArray from "./index"; 2 | 3 | describe("@common-utilities/", () => { 4 | describe("filter-array", () => { 5 | test("it removes duplicates", () => { 6 | const result = filterArray(["test", "test", "foo", "bar", "biz"]); 7 | expect(result).toEqual(["test", "foo", "bar", "biz"]); 8 | }); 9 | }); 10 | }); 11 | -------------------------------------------------------------------------------- /utilities/trace/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * trace 🖋 3 | * ---- 4 | * a common utility for tracing values 5 | * ---- 6 | * @param {label} string 7 | * @param {value} any 8 | */ 9 | export const trace = 10 | (label: string) => 11 | (value: unknown): unknown => { 12 | console.log(`${label}: ${value}`); 13 | return value; 14 | }; 15 | 16 | export default trace; 17 | -------------------------------------------------------------------------------- /utilities/new-pkg/pkg/README.md: -------------------------------------------------------------------------------- 1 | # NAME 2 | 3 | > @common-utilities/NAME 4 | 5 | DESCRIPTION 6 | 7 | ## Synopsis 8 | 9 | TODO 10 | 11 | ## Function 12 | 13 | TODO 14 | 15 | ## Roadmap 16 | 17 | - [ ] Fill out the README 18 | - [ ] Update the script and program files to ensure the script runs as wanted 19 | - [ ] Update/add tests to ensure the script and program files are properly tested 20 | -------------------------------------------------------------------------------- /utilities/curry/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import curry from "./index"; 2 | 3 | describe("@common-utilities/curry", () => { 4 | describe("curry", () => { 5 | test("it returns the first item (the head) of an array", () => { 6 | const add = (num, num2, num3) => num + num2 + num3; 7 | const result = curry(add)(1, 2)(3); 8 | expect(result).toEqual(6); 9 | }); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /utilities/curry/py/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/curry", 3 | "version": "0.1.0", 4 | "description": "curry is a function that takes a function and returns a curried version of that function 🥵", 5 | "scripts": { 6 | "build": "python -m py_compile curry.py", 7 | "test": "python -m pytest test_curry.py -v", 8 | "clean": "rm -rf __pycache__ *.pyc .pytest_cache" 9 | } 10 | } -------------------------------------------------------------------------------- /eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import eslintPluginPrettierRecommended from "eslint-plugin-prettier/recommended"; 2 | import eslint from "@eslint/js"; 3 | import tseslint from "typescript-eslint"; 4 | 5 | export default tseslint.config( 6 | { ignores: ["**/dist/*", "*.js", "*.md", "**/node_modules/**"] }, 7 | eslintPluginPrettierRecommended, 8 | eslint.configs.recommended, 9 | ...tseslint.configs.recommended, 10 | ); 11 | -------------------------------------------------------------------------------- /utilities/pipe/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import pipe from "./index"; 2 | 3 | describe("@common-utilities/", () => { 4 | describe("pipe", () => { 5 | test("it pipes from left to right", () => { 6 | const multiply = (val: number): number => val * 2; 7 | const add = (val: number): number => val + 1; 8 | const result = pipe(multiply, add); 9 | expect(result(2)).toEqual(5); 10 | }); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /utilities/snake-to-camel-case/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import snakeToCamelCase from "./index"; 2 | 3 | describe("@common-utilities/snakeToCamelCase", () => { 4 | describe("snakeToCamelCase", () => { 5 | test("it returns a snake case string", () => { 6 | const input = "camel_case_string"; 7 | const result = snakeToCamelCase(input); 8 | expect(result).toEqual("camelCaseString"); 9 | }); 10 | }); 11 | }); 12 | -------------------------------------------------------------------------------- /utilities/trim-whitespace/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import trimWhitespace from "./index"; 2 | 3 | describe("@common-utilities/", () => { 4 | describe("trim-whitespace", () => { 5 | test("it trims whitespace", () => { 6 | const result = trimWhitespace( 7 | " This is some really crazy. string. ", 8 | ); 9 | expect(result).toEqual("This is some really crazy. string."); 10 | }); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /utilities/compose/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import compose from "./index"; 2 | 3 | describe("@common-utilities/", () => { 4 | describe("compose", () => { 5 | test("it composes from right to left", () => { 6 | const add = (val: number): number => val + 1; 7 | const multiply = (val: number): number => val * 2; 8 | const result = compose(add, multiply); 9 | expect(result(2)).toEqual(5); 10 | }); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /utilities/rot13/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | export const input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; 2 | export const output = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm"; 3 | 4 | export const rot13 = (str: string): string => { 5 | return str 6 | .split("") 7 | .map((char: string): string => 8 | input.indexOf(char) > -1 ? output[input.indexOf(char)] : char, 9 | ) 10 | .join(""); 11 | }; 12 | 13 | export default rot13; 14 | -------------------------------------------------------------------------------- /utilities/update-markdown-list/ts/README.md: -------------------------------------------------------------------------------- 1 | # update-markdown-list 2 | 3 | > @common-utilities/update-markdown-list 4 | 5 | Updates a markdown list with list data 6 | 7 | ## Synopsis 8 | 9 | TODO 10 | 11 | ## Function 12 | 13 | TODO 14 | 15 | ## Roadmap 16 | 17 | - [ ] Fill out the README 18 | - [ ] Update the script and program files to ensure the script runs as wanted 19 | - [ ] Update/add tests to ensure the script and program files are properly tested 20 | -------------------------------------------------------------------------------- /utilities/filter-array/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Filter Array 🧹 3 | * ---- 4 | * a common function that removes deplicate items from an array 5 | * ---- 6 | * @param {arr} an array 7 | * @returns an array w/o duplicates 8 | * @note will not work for arrays with objects 9 | */ 10 | export const filterArray = (arr: unknown[]): unknown[] => 11 | arr.filter( 12 | (item: unknown, index: number, self: unknown[]) => 13 | self.indexOf(item) === index, 14 | ); 15 | 16 | export default filterArray; 17 | -------------------------------------------------------------------------------- /utilities/curry/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | import { F } from "ts-toolbelt"; 2 | 3 | /** 4 | * curry 5 | * ---- 6 | * DESCRIPTION 7 | * ---- 8 | * @param {function} 9 | * @returns {array} returns a function 10 | */ 11 | 12 | const curry = (fn: F.Function) => 13 | function curried(...args: Parameters) { 14 | if (args.length >= fn.length) return fn.apply(this, args); 15 | return (...args2: Parameters) => 16 | curried.apply(this, args.concat(args2)); 17 | }; 18 | 19 | export default curry; 20 | -------------------------------------------------------------------------------- /utilities/trace/ts/README.md: -------------------------------------------------------------------------------- 1 | # @common-utilities/trace 🧰👤 2 | 3 | ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555) 4 | [![npm version](https://badge.fury.io/js/%40common-utilities%2Ftrace.svg)](https://badge.fury.io/js/%40common-utilities%2Ftrace) 5 | 6 | A common function for tracing values. 7 | 8 | --- 9 | 10 | Check out the [trace page](https://www.common-utilities.com/utilities/packages/trace) in the [docs](https://www.common-utilities.com). License, MIT 11 | -------------------------------------------------------------------------------- /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /utilities/rot13/ts/README.md: -------------------------------------------------------------------------------- 1 | # @common-utilities/pipe 🧰🔐 2 | 3 | ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555) 4 | [![npm version](https://badge.fury.io/js/%40common-utilities%2Frot13.svg)](https://badge.fury.io/js/%40common-utilities%2Frot13) 5 | 6 | **Rot13** is a common function used to encrypt strings. 7 | 8 | --- 9 | 10 | Check out the [rot13 page](https://www.common-utilities.com/utilities/packages/rot13) in the [docs](https://www.common-utilities.com). License, MIT 11 | -------------------------------------------------------------------------------- /utilities/snake-to-camel-case/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * snakeToCamelCase 🐍 🐫 3 | * ---- 4 | * a utility to convert snake_case to camelCase 🐍🐫 5 | * ---- 6 | * @param {string} takes in a snake_case string 7 | * @returns {string} returns a camelCase string 8 | */ 9 | export const snakeToCamelCase = (str: string): string => 10 | str 11 | .split("_") 12 | .map((word: string, index: number) => 13 | index === 0 ? word : word[0].toUpperCase() + word.slice(1), 14 | ) 15 | .join(""); 16 | 17 | export default snakeToCamelCase; 18 | -------------------------------------------------------------------------------- /utilities/head/ts/README.md: -------------------------------------------------------------------------------- 1 | # @common-utilities/head 🧰👤 2 | 3 | ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555) 4 | [![npm version](https://badge.fury.io/js/%40common-utilities%2Fhead.svg)](https://badge.fury.io/js/%40common-utilities%2Fhead) 5 | 6 | **Head** is a common function for return the value of the first item in an Array. 7 | 8 | --- 9 | 10 | Check out the [head page](https://www.common-utilities.com/utilities/packages/head) in the [docs](https://www.common-utilities.com). License, MIT 11 | -------------------------------------------------------------------------------- /utilities/kebab-to-camel-string/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import { kebabToCamelString, kebabToCamelStringsInObject } from "./index"; 2 | 3 | describe("@common-utilities/", () => { 4 | describe("kebab-to-camel-string", () => { 5 | test("string", () => { 6 | const result = kebabToCamelString("test-thing"); 7 | expect(result).toEqual("testThing"); 8 | }); 9 | 10 | test("object", () => { 11 | const result = kebabToCamelStringsInObject({ "test-thing": "foo" }); 12 | expect(result).toEqual({ testThing: "foo" }); 13 | }); 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /utilities/curry/ts/README.md: -------------------------------------------------------------------------------- 1 | # curry 🥵 2 | 3 | ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555) 4 | [![npm version](https://badge.fury.io/js/%40common-utilities%2Fcurry.svg)](https://badge.fury.io/js/%40common-utilities%2Fcurry) 5 | 6 | **curry** is a common currying function that takes a function and returns a curried version of that function. 7 | 8 | --- 9 | 10 | Check out the [curry](https://www.common-utilities.com/utilities/packages/curry) in the [docs](https://www.common-utilities.com). License, MIT 11 | -------------------------------------------------------------------------------- /utilities/debounce/ts/README.md: -------------------------------------------------------------------------------- 1 | # @common-utilities/debounce 🧰 🏓 2 | 3 | ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555) 4 | [![npm version](https://badge.fury.io/js/%40common-utilities%2Fdebounce.svg)](https://badge.fury.io/js/%40common-utilities%2Fdebounce) 5 | 6 | **Debounce** is a common function that waits a set amount of time before invoking a callback. 7 | 8 | --- 9 | 10 | Check out the [debounce page](https://www.common-utilities.com/utilities/packages/debounce) in the [docs](https://www.common-utilities.com)! License, MIT 11 | 12 | -------------------------------------------------------------------------------- /utilities/merge-objects/ts/README.md: -------------------------------------------------------------------------------- 1 | # @common-utilities/merge-objects 🧰👯‍♂️ 2 | 3 | ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555) 4 | [![npm version](https://badge.fury.io/js/%40common-utilities%2Fmerge-objects.svg)](https://badge.fury.io/js/%40common-utilities%2merge-objects) 5 | 6 | **MergeObjects** is a common function for merging two objects deeply. 7 | 8 | --- 9 | 10 | Check out the [merge-objects page](https://www.common-utilities.com/utilities/packages/merge-objects) in the [docs](https://www.common-utilities.com). License, MIT 11 | -------------------------------------------------------------------------------- /utilities/repeat/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * repeat 🔁 3 | * @param (iterations) the number of iterations to run 4 | * @param (f) a callback function to be run on each iteration 5 | * @param (initiaValue) the intialValue 6 | * a functional recursive `while loop` which executes based iterations 7 | */ 8 | export const repeat = 9 | (iterations: number) => 10 | (callback: (initialValue: unknown) => unknown) => 11 | (initialValue: unknown): unknown => 12 | iterations === 0 13 | ? initialValue 14 | : repeat(iterations - 1)(callback)(callback(initialValue)); 15 | 16 | export default repeat; 17 | -------------------------------------------------------------------------------- /utilities/trim-whitespace/ts/README.md: -------------------------------------------------------------------------------- 1 | # @common-utilities/trim-whitespace 🧰⬜️ 2 | 3 | ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555) 4 | [![npm version](https://badge.fury.io/js/%40common-utilities%2Ftrim-whitespace.svg)](https://badge.fury.io/js/%40common-utilities%2Ftrim-whitespace) 5 | 6 | A common function for trimming whitespace without regex! 7 | 8 | --- 9 | 10 | Check out the [trim-whitespace page](https://www.common-utilities.com/utilities/packages/trim-whitespace) in the [docs](https://www.common-utilities.com). License, MIT 11 | -------------------------------------------------------------------------------- /utilities/filter-array/ts/README.md: -------------------------------------------------------------------------------- 1 | # @common-utilities/filter-array 🧰🧹 2 | 3 | ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555) 4 | [![npm version](https://badge.fury.io/js/%40common-utilities%2Ffilter-array.svg)](https://badge.fury.io/js/%40common-utilities%2Ffilter-array) 5 | 6 | **FilterArray** is a common function a common function that removes deplicate items from an array. 7 | 8 | --- 9 | 10 | Check out the [filter-array page](https://www.common-utilities.com/utilities/packages/filter-array) in the [docs](https://www.common-utilities.com)! License, MIT -------------------------------------------------------------------------------- /utilities/throttle/ts/README.md: -------------------------------------------------------------------------------- 1 | # @common-utilities/throttle 🧰⏱ 2 | 3 | ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555) 4 | [![npm version](https://badge.fury.io/js/%40common-utilities%2Fthrottle.svg)](https://badge.fury.io/js/%40common-utilities%2Ftrottle) 5 | 6 | **Throttle** is a common utility invoking a given function only once per a provided timeframe. 7 | 8 | --- 9 | 10 | Check out the [wait-until-defined page](https://www.common-utilities.com/utilities/packages/wait-until-defined) in the [docs](https://www.common-utilities.com). License, MIT 11 | -------------------------------------------------------------------------------- /utilities/compose/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * compose 🚂 3 | * ---- 4 | * a common function that takes the output from one function 5 | * and automatically patches it to the input of the next function from right to left 6 | * until it spits out the final value 7 | * ---- 8 | * @param {fns} an array of functions 9 | * @returns the next/final value 10 | */ 11 | export const compose = 12 | (...fns: unknown[]) => 13 | (patchedValue: unknown): unknown => 14 | fns.reduceRight( 15 | (fnVal: unknown, fn: (fnVal: unknown) => unknown) => fn(fnVal), 16 | patchedValue, 17 | ); 18 | 19 | export default compose; 20 | -------------------------------------------------------------------------------- /utilities/debounce/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | type Fn = (args?: unknown) => void; 2 | 3 | /** 4 | * debounce 🏓 5 | * --- 6 | * @description a basic implementation of debounce 7 | * @param fn a function callback 8 | * @param delay a number in milliseconds 9 | * @example debounce(fn, 100); 10 | */ 11 | export const debounce = 12 | (fn: Fn, delay: number, timeout = 0): Fn => 13 | (args?: unknown) => { 14 | clearTimeout(timeout); 15 | // adds `as unknown as number` to ensure setTimeout returns a number 16 | // like window.setTimeout 17 | timeout = setTimeout((): void => fn(args), delay) as unknown as number; 18 | }; 19 | -------------------------------------------------------------------------------- /.github/workflows/codesee-arch-diagram.yml: -------------------------------------------------------------------------------- 1 | # This workflow was added by CodeSee. Learn more at https://codesee.io/ 2 | # This is v2.0 of this workflow file 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request_target: 8 | types: [opened, synchronize, reopened] 9 | 10 | name: CodeSee 11 | 12 | permissions: read-all 13 | 14 | jobs: 15 | codesee: 16 | runs-on: ubuntu-latest 17 | continue-on-error: true 18 | name: Analyze the repo with CodeSee 19 | steps: 20 | - uses: Codesee-io/codesee-action@v2 21 | with: 22 | codesee-token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }} 23 | -------------------------------------------------------------------------------- /utilities/snake-to-camel-case/ts/README.md: -------------------------------------------------------------------------------- 1 | # Snake To Camel Case 🐍🐫 2 | 3 | ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555) 4 | [![npm version](https://badge.fury.io/js/%40common-utilities%2Frot13.svg)](https://badge.fury.io/js/%40common-utilities%2snake-to-camel-case) 5 | 6 | **snake-to-camel-case** is a common function used to convert a snake_case string to camelCase. 7 | 8 | --- 9 | 10 | Check out the [snake-to-camel-case](https://www.common-utilities.com/utilities/packages/snake-to-camel-case) in the [docs](https://www.common-utilities.com). License, MIT 11 | -------------------------------------------------------------------------------- /utilities/compose/ts/README.md: -------------------------------------------------------------------------------- 1 | # @common-utilities/compose 🧰 🚂 2 | 3 | ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555) 4 | [![npm version](https://badge.fury.io/js/%40common-utilities%2Fcompose.svg)](https://badge.fury.io/js/%40common-utilities%2Fcompose) 5 | 6 | **Compose** is a common function composed of function arguments which returns their value to the next function until returning a final value. 7 | 8 | --- 9 | 10 | Check out the [compose page](https://www.common-utilities.com/utilities/packages/compose) in the [docs](https://www.common-utilities.com)! License, MIT 11 | -------------------------------------------------------------------------------- /utilities/pipe/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * pipe ⛓ 3 | * ---- 4 | * a common function that take the output from one function 5 | * and automatically patches it to the input of the next function from left to right 6 | * until it spits out the final value in the opposite order of Compose. 7 | * ---- 8 | * @param {fns} an array of functions 9 | * @returns the last/final value 10 | */ 11 | export const pipe = 12 | (...fns: unknown[]) => 13 | (patchedValue: unknown): unknown => 14 | fns.reduce( 15 | (fnVal: unknown, fn: (fnVal: unknown) => unknown) => fn(fnVal), 16 | patchedValue, 17 | ); 18 | 19 | export default pipe; 20 | -------------------------------------------------------------------------------- /utilities/pipe/ts/README.md: -------------------------------------------------------------------------------- 1 | # @common-utilities/pipe 🧰⛓ 2 | 3 | ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555) 4 | [![npm version](https://badge.fury.io/js/%40common-utilities%2Fpipe.svg)](https://badge.fury.io/js/%40common-utilities%2Fpipe) 5 | 6 | **Pipe** is a common function composed of function arguments which returns their value to the next function until returning a final value in the opposite order of compose. 7 | 8 | --- 9 | 10 | Check out the [pipe page](https://www.common-utilities.com/utilities/packages/pipe) in the [docs](https://www.common-utilities.com). License, MIT 11 | -------------------------------------------------------------------------------- /utilities/string-interpolation/ts/README.md: -------------------------------------------------------------------------------- 1 | # @common-utilities/string-interpolation 🧰🧵 2 | 3 | ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555) 4 | [![npm version](https://badge.fury.io/js/%40common-utilities%2Fstring-interpolation.svg)](https://badge.fury.io/js/%40common-utilities%2Fstring-interpolation) 5 | 6 | **String Interpolation** is a common function for interpolating variables in strings. 7 | 8 | --- 9 | 10 | Check out the [string-interpolation page](https://www.common-utilities.com/utilities/packages/string-interpolation) in the [docs](https://www.common-utilities.com). License, MIT -------------------------------------------------------------------------------- /utilities/is-object/ts/README.md: -------------------------------------------------------------------------------- 1 | # @common-utilities/is-object 🧰🎛 2 | 3 | ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555) 4 | [![npm version](https://badge.fury.io/js/%40common-utilities%2Fis-object.svg)](https://badge.fury.io/js/%40common-utilities%2is-object) 5 | 6 | **IsObject** is a common function for knowings whether data is of Object type. 7 | This function comes with `isArray` and `isOfObjectTypes` helper methods. 8 | 9 | --- 10 | 11 | Check out the [is-object page](https://www.common-utilities.com/utilities/packages/is-object) in the [docs](https://www.common-utilities.com). License, MIT 12 | -------------------------------------------------------------------------------- /utilities/kebab-to-camel-string/ts/README.md: -------------------------------------------------------------------------------- 1 | # @common-utilitiee/kebab-to-camel-string 🧰🍢🐫 2 | 3 | ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555) 4 | [![npm version](https://badge.fury.io/js/%40common-utilities%2Fkebab-to-camel-string.svg)](https://badge.fury.io/js/%40common-utilities%2Fkebab-to-camel-string) 5 | 6 | **kebabToCamelString** is a common function for returning a kebab string as a camel string. 7 | 8 | --- 9 | 10 | Check out the [kebab-to-camel-string page](https://www.common-utilities.com/utilities/packages/kebab-to-camel-string) in the [docs](https://www.common-utilities.com). License, MIT 11 | -------------------------------------------------------------------------------- /utilities/repeat/ts/README.md: -------------------------------------------------------------------------------- 1 | # @common-utilities/repeat 🧰🔁 2 | 3 | ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555) 4 | [![npm version](https://badge.fury.io/js/%40common-utilities%2Frepeat.svg)](https://badge.fury.io/js/%40common-utilities%2Frepeat) 5 | 6 | **Repeat** is a common function composed of function arguments which recursively invoke a callback function based on iterations returning a final value. 7 | 8 | The repeat function can be used to replace while loops. 9 | 10 | --- 11 | 12 | Check out the [repeat page](https://www.common-utilities.com/utilities/packages/repeat) in the [docs](https://www.common-utilities.com). License, MIT 13 | -------------------------------------------------------------------------------- /utilities/wait-until-defined/ts/README.md: -------------------------------------------------------------------------------- 1 | # @common-utilities/wait-until-defined 🧰 🚂 2 | 3 | ![Typed with TypeScript](https://flat.badgen.net/badge/icon/Typed?icon=typescript&label&labelColor=blue&color=555555) 4 | [![npm version](https://badge.fury.io/js/%40common-utilities%2Fwait-until-defined.svg)](https://badge.fury.io/js/%40common-utilities%2Fwait-until-defined) 5 | 6 | **Wait Until Defined** is a common utility that waits and checks for a callback function to returns true. This is useful to wait until data is defined. 7 | 8 | --- 9 | 10 | Check out the [wait-until-defined page](https://www.common-utilities.com/utilities/packages/wait-until-defined) in the [docs](https://www.common-utilities.com). License, MIT 11 | -------------------------------------------------------------------------------- /utilities/string-interpolation/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import stringInterpolation from "./index"; 2 | 3 | describe("@common-utilities/", () => { 4 | describe("stringInterpolation", () => { 5 | test("it does string interpolation", () => { 6 | const result = stringInterpolation("This string has #{dynamicData}", [ 7 | { dynamicData: "a knot in it" }, 8 | ]); 9 | expect(result).toEqual("This string has a knot in it"); 10 | }); 11 | 12 | test("it returns the original string", () => { 13 | const result = stringInterpolation("This string has #{dynamicData}", [ 14 | {}, 15 | ]); 16 | expect(result).toEqual("This string has #{dynamicData}"); 17 | }); 18 | }); 19 | }); 20 | -------------------------------------------------------------------------------- /utilities/throttle/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | type Fn = (args?: unknown) => void; 2 | type TimeoutHandler = null | number; 3 | 4 | /** 5 | * throttle ⏱ 6 | * --- 7 | * @param fn 8 | * @param delay 9 | * @param timeoutHandler 10 | * @returns {Fn} 11 | * @description a basic implementation of throttle 12 | * @example debounce(fn, 100); 13 | */ 14 | export const throttle = 15 | (fn: Fn, delay: number, timeoutHandler: TimeoutHandler = null): Fn => 16 | (args?: unknown): TimeoutHandler => { 17 | if (!timeoutHandler) { 18 | timeoutHandler = setTimeout( 19 | (): void => fn(args), 20 | (timeoutHandler = null), 21 | delay, 22 | ) as unknown as number; 23 | } 24 | return timeoutHandler; 25 | }; 26 | -------------------------------------------------------------------------------- /.codependencerc: -------------------------------------------------------------------------------- 1 | { 2 | "codependencies": [ 3 | "@commitlint/cli", 4 | "@commitlint/config-lerna-scopes", 5 | "@commitlint/prompt", 6 | "@swc/jest", 7 | "@types/jest", 8 | "@types/node", 9 | "@typescript-eslint/eslint-plugin", 10 | "@typescript-eslint/parser", 11 | "codependence", 12 | "commitizen", 13 | "eslint", 14 | "eslint-config-prettier", 15 | "husky", 16 | "jest", 17 | "lint-staged", 18 | "prettier", 19 | "rimraf", 20 | "ts-node", 21 | "tsconfig-paths", 22 | "tslib", 23 | "tsutils", 24 | "typescript", 25 | "@types/fs-extra", 26 | "@types/inquirer", 27 | "commander", 28 | "fs-extra", 29 | { "inquirer": "^8.0.0" } 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /utilities/string-interpolation/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * stringInterpolation 🧵 3 | * --- 4 | * a common utility for interpolating variables in strings 5 | * --- 6 | * @param str a string 7 | * @param arr an array of objects 8 | */ 9 | 10 | export type KeyValueStringsObject = { 11 | [key: string]: string; 12 | }; 13 | 14 | export const stringInterpolation = ( 15 | str: string, 16 | arr: KeyValueStringsObject[], 17 | ): string => 18 | str && arr 19 | ? arr.reduce((generatedStr: string, item: KeyValueStringsObject) => { 20 | const dynamicKey: string = Object.keys(item).toString(); 21 | return generatedStr.replace(`#{${dynamicKey}}`, item[dynamicKey]); 22 | }, str) 23 | : str; 24 | 25 | export default stringInterpolation; 26 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "./packages", 4 | "allowJs": false, 5 | "allowSyntheticDefaultImports": true, 6 | "declaration": true, 7 | "esModuleInterop": true, 8 | "checkJs": false, 9 | "jsx": "react", 10 | "importHelpers": true, 11 | "lib": ["esnext", "dom", "es6", "dom.iterable"], 12 | "module": "commonjs", 13 | "moduleResolution": "node", 14 | "noEmit": false, 15 | "noImplicitReturns": true, 16 | "noUnusedLocals": true, 17 | "noUnusedParameters": true, 18 | "preserveConstEnums": true, 19 | "removeComments": false, 20 | "resolveJsonModule": true, 21 | "skipLibCheck": true, 22 | "sourceMap": true, 23 | "target": "es6" 24 | }, 25 | "exclude": ["dist", "**/*.test.ts", "packages/*/dist/**", "*.js"] 26 | } 27 | -------------------------------------------------------------------------------- /utilities/rot13/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/rot13", 3 | "version": "0.0.1", 4 | "description": "A basic implementation of the common utility function, rot13", 5 | "main": "dist/index.js", 6 | "module": "dist/index.js", 7 | "typings": "dist/index.d.ts", 8 | "license": "MIT", 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "repository": "git@github.com:yowainwright/common-utilities.git", 13 | "author": "Jeff Wainwright (jeffry.in)", 14 | "scripts": { 15 | "build": "tsc", 16 | "clean": "rimraf dist" 17 | }, 18 | "jest": { 19 | "name": "@common-utilities/rot13", 20 | "rootDir": "./", 21 | "roots": [ "/src"] 22 | }, 23 | "keywords": [ 24 | "rot13", 25 | "utility", 26 | "functional" 27 | ] 28 | } 29 | -------------------------------------------------------------------------------- /utilities/new-pkg/pkg/pkg-package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/NAME", 3 | "version": "0.0.1", 4 | "description": "DESCRIPTION", 5 | "types": "dist/index.d.ts", 6 | "files": [ 7 | "dist" 8 | ], 9 | "private": true, 10 | "scripts": { 11 | "build": "tsc", 12 | "clean": "rimraf dist", 13 | "link:bin": "npm link", 14 | "tsc:check": "tsc --noEmit" 15 | }, 16 | "jest": { 17 | "name": "@common-utilities/NAME", 18 | "rootDir": "./", 19 | "roots": [ "/src"] 20 | }, 21 | "repository": { 22 | "type": "git", 23 | "url": "git+https://github.com/yowainwright/common-utilities.git" 24 | }, 25 | "bugs": { 26 | "url": "https://github.com/yowainwright/common-utilities/issues" 27 | }, 28 | "homepage": "https://github.com/yowainwright/common-utilities#readme" 29 | } 30 | -------------------------------------------------------------------------------- /utilities/debounce/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import { debounce } from "./index"; 2 | 3 | describe("@common-utilities/", () => { 4 | describe("debounce", () => { 5 | it("executes just once", () => { 6 | jest.useFakeTimers(); 7 | const callback = jest.fn(); 8 | const debouncedCallback = debounce(callback, 10); 9 | Array.from({ length: 100 }, () => debouncedCallback()); 10 | expect(callback).not.toHaveBeenCalled(); 11 | jest.runAllTimers(); 12 | expect(callback).toBeCalledTimes(1); 13 | }); 14 | 15 | it("executes with args", () => { 16 | jest.useFakeTimers(); 17 | let result = 1; 18 | const add1 = (val) => { 19 | result = val + 1; 20 | }; 21 | debounce(add1, 10)(1); 22 | jest.runAllTimers(); 23 | expect(result).toEqual(2); 24 | }); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /utilities/pipe/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/pipe", 3 | "version": "0.1.3", 4 | "description": "A basic implementation of the common utility function, Pipe", 5 | "main": "dist/index.js", 6 | "module": "dist/index.js", 7 | "typings": "dist/index.d.ts", 8 | "license": "MIT", 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "repository": "git@github.com:yowainwright/common-utilities.git", 13 | "author": "Jeff Wainwright (jeffry.in)", 14 | "scripts": { 15 | "build": "tsc", 16 | "clean": "rimraf dist" 17 | }, 18 | "jest": { 19 | "name": "@common-utilities/pipe", 20 | "rootDir": "./", 21 | "roots": [ "/src"] 22 | }, 23 | "keywords": [ 24 | "pipe", 25 | "piping", 26 | "reduce", 27 | "utility", 28 | "functional" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /utilities/throttle/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import { throttle } from "./index"; 2 | 3 | describe("@common-utilities/", () => { 4 | describe("throttle", () => { 5 | it("executes just once", () => { 6 | jest.useFakeTimers(); 7 | const callback = jest.fn(); 8 | const throttledCallback = throttle(callback, 10); 9 | Array.from({ length: 100 }, () => throttledCallback()); 10 | expect(callback).not.toHaveBeenCalled(); 11 | jest.runAllTimers(); 12 | expect(callback).toBeCalledTimes(1); 13 | }); 14 | 15 | it("executes with args", () => { 16 | jest.useFakeTimers(); 17 | let result = 1; 18 | const add1 = (val) => { 19 | result = val + 1; 20 | }; 21 | throttle(add1, 10)(1); 22 | jest.runAllTimers(); 23 | expect(result).toEqual(2); 24 | }); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /utilities/head/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/head", 3 | "version": "0.1.3", 4 | "description": "A basic implementation of the common utility function, Head 👤", 5 | "main": "dist/index.js", 6 | "module": "dist/index.js", 7 | "typings": "dist/index.d.ts", 8 | "license": "MIT", 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "repository": "git@github.com:yowainwright/common-utilities.git", 13 | "author": "Jeff Wainwright (jeffry.in)", 14 | "scripts": { 15 | "build": "tsc", 16 | "clean": "rimraf dist" 17 | }, 18 | "jest": { 19 | "name": "@common-utilities/head", 20 | "rootDir": "./", 21 | "roots": [ "/src"] 22 | }, 23 | "keywords": [ 24 | "spread", 25 | "head", 26 | "array", 27 | "utility", 28 | "functional" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /utilities/compose/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/compose", 3 | "version": "0.1.3", 4 | "description": "A basic implementation of the common utility function, Compose 🚂", 5 | "main": "dist/index.js", 6 | "module": "dist/index.js", 7 | "typings": "dist/index.d.ts", 8 | "license": "MIT", 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "repository": "git@github.com:yowainwright/common-utilities.git", 13 | "author": "Jeff Wainwright (jeffry.in)", 14 | "scripts": { 15 | "build": "tsc", 16 | "clean": "rimraf dist" 17 | }, 18 | "jest": { 19 | "name": "@common-utilities/compose", 20 | "rootDir": "./", 21 | "roots": [ "/src"] 22 | }, 23 | "keywords": [ 24 | "compose", 25 | "common-utilities", 26 | "utility", 27 | "functional" 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /utilities/debounce/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/debounce", 3 | "version": "0.0.2", 4 | "description": "A basic implementation of the common utility function, Debounce 🏓", 5 | "main": "dist/index.js", 6 | "module": "dist/index.js", 7 | "typings": "dist/index.d.ts", 8 | "license": "MIT", 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "repository": "git@github.com:yowainwright/common-utilities.git", 13 | "author": "Jeff Wainwright (jeffry.in)", 14 | "scripts": { 15 | "build": "tsc", 16 | "clean": "rimraf dist" 17 | }, 18 | "jest": { 19 | "name": "@common-utilities/debounce", 20 | "rootDir": "./", 21 | "roots": [ "/src"] 22 | }, 23 | "keywords": [ 24 | "debounce", 25 | "common-utilities", 26 | "utility", 27 | "functional" 28 | ] 29 | } 30 | -------------------------------------------------------------------------------- /.github/workflows/nodejs.yml: -------------------------------------------------------------------------------- 1 | name: Node.js CI 2 | 3 | on: 4 | pull_request: 5 | branches: [main] 6 | 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | 11 | strategy: 12 | matrix: 13 | node-version: [20.x] 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | - uses: pnpm/action-setup@v4 18 | with: 19 | version: latest 20 | - name: Use Node.js ${{ matrix.node-version }} 21 | uses: actions/setup-node@v4 22 | with: 23 | node-version: ${{ matrix.node-version }} 24 | cache: 'pnpm' 25 | # --no-frozen-lockfile is required so that dependabot with automerge can work 26 | # https://github.com/dependabot/dependabot-core/issues/1736 27 | - run: pnpm install -r --no-frozen-lockfile 28 | - run: pnpm build 29 | - run: pnpm test 30 | env: 31 | CI: true 32 | -------------------------------------------------------------------------------- /utilities/is-object/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/is-object", 3 | "version": "0.1.3", 4 | "description": "Basic implementations of common utility function that check if data is an object 🎛", 5 | "main": "dist/index.js", 6 | "module": "dist/index.js", 7 | "typings": "dist/index.d.ts", 8 | "license": "MIT", 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "repository": "git@github.com:yowainwright/common-utilities.git", 13 | "author": "Jeff Wainwright (jeffry.in)", 14 | "scripts": { 15 | "build": "tsc", 16 | "clean": "rimraf dist" 17 | }, 18 | "jest": { 19 | "name": "@common-utilities/is-object", 20 | "rootDir": "./", 21 | "roots": [ "/src"] 22 | }, 23 | "keywords": [ 24 | "object", 25 | "array", 26 | "is-object", 27 | "utility", 28 | "functional" 29 | ] 30 | } 31 | -------------------------------------------------------------------------------- /utilities/trace/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/trace", 3 | "version": "0.1.3", 4 | "description": "A basic implementation of the common utility function, Trace 🖋", 5 | "main": "dist/index.js", 6 | "module": "dist/index.js", 7 | "typings": "dist/index.d.ts", 8 | "license": "MIT", 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "repository": "git@github.com:yowainwright/common-utilities.git", 13 | "author": "Jeff Wainwright (jeffry.in)", 14 | "scripts": { 15 | "build": "tsc", 16 | "clean": "rimraf dist" 17 | }, 18 | "jest": { 19 | "name": "@common-utilities/trace", 20 | "rootDir": "./", 21 | "roots": [ "/src"] 22 | }, 23 | "keywords": [ 24 | "log", 25 | "check", 26 | "development", 27 | "debug", 28 | "debugging", 29 | "utility", 30 | "functional" 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /utilities/filter-array/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/filter-array", 3 | "version": "0.1.3", 4 | "description": "A basic implementation of the common utility function, filter-array 🧹", 5 | "main": "dist/index.js", 6 | "module": "dist/index.js", 7 | "typings": "dist/index.d.ts", 8 | "license": "MIT", 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "repository": "git@github.com:yowainwright/common-utilities.git", 13 | "author": "Jeff Wainwright (jeffry.in)", 14 | "scripts": { 15 | "build": "tsc", 16 | "clean": "rimraf dist" 17 | }, 18 | "jest": { 19 | "name": "@common-utilities/filter-array", 20 | "rootDir": "./", 21 | "roots": [ "/src"] 22 | }, 23 | "keywords": [ 24 | "array", 25 | "map", 26 | "set", 27 | "filtering", 28 | "filter-array", 29 | "utility", 30 | "functional" 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /utilities/kebab-to-camel-string/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/kebab-to-camel-string", 3 | "version": "0.1.3", 4 | "description": "A common function for returning a kebab string as a camel string. 🍢🐫", 5 | "main": "dist/index.js", 6 | "module": "dist/index.js", 7 | "typings": "dist/index.d.ts", 8 | "license": "MIT", 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "repository": "git@github.com:yowainwright/common-utilities.git", 13 | "author": "Jeff Wainwright (jeffry.in)", 14 | "scripts": { 15 | "build": "tsc", 16 | "clean": "rimraf dist" 17 | }, 18 | "jest": { 19 | "name": "@common-utilities/kebab-to-camel-string", 20 | "rootDir": "./", 21 | "roots": [ "/src"] 22 | }, 23 | "keywords": [ 24 | "strings", 25 | "no-regex", 26 | "text", 27 | "formatting", 28 | "utility", 29 | "functional" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /utilities/throttle/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/throttle", 3 | "version": "0.0.1", 4 | "description": "A basic implementation of the common utility function, throttle ⏱", 5 | "homepage": "https://github.com/yowainwright/common-utilities#readme", 6 | "license": "MIT", 7 | "publishConfig": { 8 | "access": "public" 9 | }, 10 | "main": "dist/index.js", 11 | "module": "dist/index.js", 12 | "typings": "dist/index.d.ts", 13 | "repository": "git@github.com:yowainwright/common-utilities.git", 14 | "author": "Jeff Wainwright (jeffry.in)", 15 | "scripts": { 16 | "build": "tsc", 17 | "clean": "rimraf dist" 18 | }, 19 | "jest": { 20 | "name": "@common-utilities/debounce", 21 | "rootDir": "./", 22 | "roots": [ 23 | "/src" 24 | ] 25 | }, 26 | "keywords": [ 27 | "debounce", 28 | "common-utilities", 29 | "utility", 30 | "functional" 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /utilities/merge-objects/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/merge-objects", 3 | "version": "0.1.3", 4 | "description": "A basic implementation of the common utility function, merge-objects 👯‍♂️", 5 | "main": "dist/index.js", 6 | "module": "dist/index.js", 7 | "typings": "dist/index.d.ts", 8 | "license": "MIT", 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "repository": "git@github.com:yowainwright/common-utilities.git", 13 | "author": "Jeff Wainwright (jeffry.in)", 14 | "scripts": { 15 | "build": "tsc", 16 | "clean": "rimraf dist" 17 | }, 18 | "jest": { 19 | "name": "@common-utilities/merge-objects", 20 | "rootDir": "./", 21 | "roots": [ "/src"] 22 | }, 23 | "keywords": [ 24 | "objects", 25 | "deep merge", 26 | "deep-merge", 27 | "merge-objects", 28 | "grouping", 29 | "group", 30 | "utility", 31 | "functional" 32 | ] 33 | } 34 | -------------------------------------------------------------------------------- /utilities/string-interpolation/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/string-interpolation", 3 | "version": "0.1.3", 4 | "description": "A common utility for interpolating variables in strings, string-interpolation", 5 | "main": "dist/index.js", 6 | "module": "dist/index.js", 7 | "typings": "dist/index.d.ts", 8 | "license": "MIT", 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "repository": "git@github.com:yowainwright/common-utilities.git", 13 | "author": "Jeff Wainwright (jeffry.in)", 14 | "scripts": { 15 | "build": "tsc", 16 | "clean": "rimraf dist" 17 | }, 18 | "jest": { 19 | "name": "@common-utilities/string-interpolation", 20 | "rootDir": "./", 21 | "roots": [ "/src"] 22 | }, 23 | "keywords": [ 24 | "dynamic", 25 | "interpolation", 26 | "text", 27 | "strings", 28 | "formatting", 29 | "utility", 30 | "functional" 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /utilities/kebab-to-camel-string/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | export type ObjectOfStrings = { 2 | [key: string]: string; 3 | }; 4 | 5 | export const kebabToCamelString = (kebabString: string): string => 6 | kebabString 7 | .split("-") 8 | .map((camelString: string, i: number): string => 9 | i === 0 10 | ? camelString 11 | : camelString 12 | ? `${camelString.charAt(0).toUpperCase()}${camelString.slice(1)}` 13 | : "", 14 | ) 15 | .join(""); 16 | 17 | export const kebabToCamelStringsInObject = ( 18 | kebabObjectStrings: ObjectOfStrings, 19 | ): ObjectOfStrings => 20 | Object.keys(kebabObjectStrings).length 21 | ? Object.entries(kebabObjectStrings) 22 | .map(([kebabKey, value]) => [`${kebabToCamelString(kebabKey)}`, value]) 23 | .reduce( 24 | (flags, [key, value]) => Object.assign(flags, { [key]: value }), 25 | {}, 26 | ) 27 | : {}; 28 | 29 | export default kebabToCamelStringsInObject; 30 | -------------------------------------------------------------------------------- /utilities/trim-whitespace/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/trim-whitespace", 3 | "version": "0.1.2", 4 | "description": "A basic implementation of the common utility function, trim-whitespace ⬜️", 5 | "main": "dist/index.js", 6 | "module": "dist/index.js", 7 | "typings": "dist/index.d.ts", 8 | "license": "MIT", 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "repository": "git@github.com:yowainwright/common-utilities.git", 13 | "author": "Jeff Wainwright (jeffry.in)", 14 | "scripts": { 15 | "build": "tsc", 16 | "clean": "rimraf dist" 17 | }, 18 | "jest": { 19 | "name": "@common-utilities/trim-whitespace", 20 | "rootDir": "./", 21 | "roots": [ "/src"] 22 | }, 23 | "keywords": [ 24 | "white-space", 25 | "no regex", 26 | "whitespace", 27 | "trim", 28 | "clean", 29 | "text", 30 | "formatting", 31 | "utility", 32 | "functional" 33 | ] 34 | } 35 | -------------------------------------------------------------------------------- /utilities/repeat/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/repeat", 3 | "version": "0.1.3", 4 | "description": "A common function composed of function arguments which recursively invoke a callback function based on iterations returning a final value", 5 | "main": "dist/index.js", 6 | "module": "dist/index.js", 7 | "typings": "dist/index.d.ts", 8 | "license": "MIT", 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "repository": "git@github.com:yowainwright/common-utilities.git", 13 | "author": "Jeff Wainwright (jeffry.in)", 14 | "scripts": { 15 | "build": "tsc", 16 | "clean": "rimraf dist" 17 | }, 18 | "jest": { 19 | "name": "@common-utilities/repeat", 20 | "rootDir": "./", 21 | "roots": [ "/src"] 22 | }, 23 | "keywords": [ 24 | "repeat", 25 | "recursive", 26 | "currying", 27 | "functaional-while", 28 | "while", 29 | "utility", 30 | "functional" 31 | ] 32 | } 33 | -------------------------------------------------------------------------------- /utilities/wait-until-defined/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/wait-until-defined", 3 | "version": "1.1.2", 4 | "description": "A basic implementation of the common utility function, wait until defined ⌚️", 5 | "main": "dist/index.js", 6 | "module": "dist/index.js", 7 | "typings": "dist/index.d.ts", 8 | "license": "MIT", 9 | "publishConfig": { 10 | "access": "public" 11 | }, 12 | "repository": "git@github.com:yowainwright/common-utilities.git", 13 | "author": "Jeff Wainwright (jeffry.in)", 14 | "scripts": { 15 | "build": "tsc", 16 | "clean": "rimraf dist" 17 | }, 18 | "jest": { 19 | "name": "@common-utilities/wait-until-defined", 20 | "rootDir": "./", 21 | "roots": [ "/src"] 22 | }, 23 | "keywords": [ 24 | "aysnc", 25 | "wait", 26 | "await", 27 | "callback", 28 | "later", 29 | "wait-until", 30 | "until", 31 | "functional", 32 | "typescript", 33 | "utility" 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /utilities/curry/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/curry", 3 | "version": "0.1.0", 4 | "description": "curry is a function that takes a function and returns a curried version of that function 🥵", 5 | "main": "dist/index.js", 6 | "module": "dist/index.js", 7 | "types": "dist/index.d.ts", 8 | "typings": "dist/index.d.ts", 9 | "files": [ 10 | "dist" 11 | ], 12 | "publishConfig": { 13 | "access": "public" 14 | }, 15 | "scripts": { 16 | "build": "tsc", 17 | "clean": "rimraf dist", 18 | "link:bin": "npm link", 19 | "tsc:check": "tsc --noEmit" 20 | }, 21 | "jest": { 22 | "name": "@common-utilities/curry", 23 | "rootDir": "./", 24 | "roots": [ 25 | "/src" 26 | ] 27 | }, 28 | "repository": { 29 | "type": "git", 30 | "url": "git+https://github.com/yowainwright/common-utilities.git" 31 | }, 32 | "bugs": { 33 | "url": "https://github.com/yowainwright/common-utilities/issues" 34 | }, 35 | "homepage": "https://github.com/yowainwright/common-utilities#readme" 36 | } 37 | -------------------------------------------------------------------------------- /utilities/update-markdown-list/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/update-markdown-list", 3 | "version": "0.0.1", 4 | "description": "updates a markdown list with json data", 5 | "main": "dist/index.js", 6 | "module": "dist/index.js", 7 | "types": "dist/index.d.ts", 8 | "typings": "dist/index.d.ts", 9 | "types": "dist/index.d.ts", 10 | "bin": { 11 | "update-md-list": "./dist/cli.js" 12 | }, 13 | "files": [ 14 | "dist" 15 | ], 16 | "private": true, 17 | "scripts": { 18 | "build": "tsc", 19 | "clean": "rimraf dist", 20 | "link:bin": "npm link", 21 | "tsc:check": "tsc --noEmit" 22 | }, 23 | "jest": { 24 | "name": "@common-utilities/update-markdown-list", 25 | "rootDir": "./", 26 | "roots": [ "/src"] 27 | }, 28 | "repository": { 29 | "type": "git", 30 | "url": "git+https://github.com/yowainwright/common-utilities.git" 31 | }, 32 | "bugs": { 33 | "url": "https://github.com/yowainwright/common-utilities/issues" 34 | }, 35 | "homepage": "https://github.com/yowainwright/common-utilities#readme" 36 | } 37 | -------------------------------------------------------------------------------- /utilities/snake-to-camel-case/ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/snake-to-camel-case", 3 | "version": "0.1.0", 4 | "description": "a utility to convert a snake_case string to camelCase 🐍🐫", 5 | "main": "dist/index.js", 6 | "module": "dist/index.js", 7 | "types": "dist/index.d.ts", 8 | "typings": "dist/index.d.ts", 9 | "types": "dist/index.d.ts", 10 | "files": [ 11 | "dist" 12 | ], 13 | "publishConfig": { 14 | "access": "public" 15 | }, 16 | "scripts": { 17 | "build": "tsc", 18 | "clean": "rimraf dist", 19 | "link:bin": "npm link", 20 | "tsc:check": "tsc --noEmit" 21 | }, 22 | "jest": { 23 | "name": "@common-utilities/snake-to-camel-case", 24 | "rootDir": "./", 25 | "roots": [ 26 | "/src" 27 | ] 28 | }, 29 | "repository": { 30 | "type": "git", 31 | "url": "git+https://github.com/yowainwright/common-utilities.git" 32 | }, 33 | "bugs": { 34 | "url": "https://github.com/yowainwright/common-utilities/issues" 35 | }, 36 | "homepage": "https://github.com/yowainwright/common-utilities#readme" 37 | } 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Jeff Wainwright 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /utilities/wait-until-defined/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import { wait, isDefined, checkDefinition, waitUntilDefined } from "./index"; 2 | 3 | describe("@common-utilities/", () => { 4 | describe("wait-until-defined", () => { 5 | it("wait", async () => { 6 | let test; 7 | setTimeout(() => { 8 | test = 2; 9 | }, 10); 10 | const result = await wait(30); 11 | expect(result).toBe(true); 12 | expect(test).toEqual(2); 13 | }); 14 | 15 | it("isDefined", async () => { 16 | const thing = "yay"; 17 | const testVar = () => thing === "yay"; 18 | const result = await isDefined(testVar); 19 | expect(result).toEqual(true); 20 | }); 21 | }); 22 | 23 | it("checkDefinition", async () => { 24 | const thing = "yay"; 25 | const testVar = () => thing === "yay"; 26 | const result = await checkDefinition(testVar, 10, 1); 27 | expect(result).toEqual(true); 28 | }); 29 | 30 | it("waitUntilDefined", async () => { 31 | const thing = "yay"; 32 | const testVar = () => thing === "yay"; 33 | const result = await waitUntilDefined(testVar, 10, 1); 34 | expect(result).toEqual(true); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /utilities/new-pkg/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/new-pkg", 3 | "version": "0.0.1", 4 | "description": "Creates a new `common-utilities` batteries included pkg 📦", 5 | "author": "Jeff Wainwright (yowainwright@gmail.com)", 6 | "license": "MIT", 7 | "private": true, 8 | "type": "module", 9 | "bin": { 10 | "create-new": "./dist/program.js" 11 | }, 12 | "files": [ 13 | "dist", 14 | "pkg" 15 | ], 16 | "scripts": { 17 | "build": "tsc", 18 | "cmd:test:run": "ts-node src/index.ts", 19 | "test:new-pkg": "echo '🚧 building a test package...' && ts-node src/program.ts package -d 'Testing new package' -n 'test'", 20 | "test:new-pkg-exists": "path-exists packages/test && echo '🎉 The test package exists!'", 21 | "test:clean-up": "echo '⏱ deleting test packages...' && rimraf packages", 22 | "test": "pnpm test:new-pkg && pnpm test:new-pkg-exists && pnpm test:clean-up" 23 | }, 24 | "dependencies": { 25 | "commander": "^11.0.0", 26 | "fs-extra": "^11.1.1", 27 | "inquirer": "^9.2.8" 28 | }, 29 | "devDependencies": { 30 | "@types/fs-extra": "^11.0.0", 31 | "@types/inquirer": "^9.0.0" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /utilities/update-markdown-list/ts/src/cli.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | import { fileURLToPath } from "url"; 3 | import { processPackages, logger } from "./"; 4 | 5 | // Manual parsing of command-line arguments 6 | let log; 7 | const args = process.argv.slice(2); 8 | const options = { 9 | pkgsDir: "", 10 | md: "", 11 | jsonFile: "", 12 | isLogging: false, 13 | }; 14 | 15 | args.forEach((arg, index) => { 16 | switch (arg) { 17 | case "--pkgsDir": 18 | case "-p": 19 | options.pkgsDir = args[index + 1]; 20 | break; 21 | case "--md": 22 | case "-m": 23 | options.md = args[index + 1]; 24 | break; 25 | case "--jsonFile": 26 | case "-j": 27 | options.jsonFile = args[index + 1]; 28 | break; 29 | case "--isLogging": 30 | case "-l": 31 | options.isLogging = true; 32 | break; 33 | } 34 | const file = fileURLToPath(import.meta.url); 35 | log = logger({ file, isLogging: options.isLogging }); 36 | }); 37 | 38 | // Check if the 'process' command is provided 39 | if (args.includes("process")) { 40 | const { pkgsDir, md, jsonFile, isLogging } = options; 41 | processPackages(pkgsDir, md, jsonFile, isLogging); 42 | } else { 43 | log.error('Invalid command. Use "process" to start processing packages.'); 44 | } 45 | -------------------------------------------------------------------------------- /.github/workflows/update.yml: -------------------------------------------------------------------------------- 1 | name: update codependencies 2 | 3 | on: 4 | schedule: 5 | - cron: '0 5 * * 2' 6 | 7 | jobs: 8 | udpate-deps: 9 | runs-on: ubuntu-latest 10 | 11 | strategy: 12 | matrix: 13 | node-version: [20.x] 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | - uses: pnpm/action-setup@v4 18 | with: 19 | version: latest 20 | - name: Use Node.js ${{ matrix.node-version }} 21 | uses: actions/setup-node@v4 22 | with: 23 | node-version: ${{ matrix.node-version }} 24 | cache: 'pnpm' 25 | - run: pnpm install --no-frozen-lockfile 26 | - run: pnpm build 27 | - run: pnpm run update 28 | - run: pnpm install --no-frozen-lockfile 29 | - name: Create Pull Request 30 | uses: peter-evans/create-pull-request@v6 31 | with: 32 | token: ${{ secrets.PR_CREATE_TOKEN }} 33 | commit-message: 'chore: update dependencies' 34 | title: '[Codependence] update dependencies' 35 | body: | 36 | ## Dependency updates 37 | 38 | Auto-generated by [codependence][1] using [create-pull-request][2] 39 | 40 | [1]: https://github.com/yowainwright/common-utilities 41 | [2]: https://github.com/peter-evans/create-pull-request 42 | branch: update-dependencies 43 | labels: codependencies 44 | -------------------------------------------------------------------------------- /utilities/update-markdown-list/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import { getJsonData, updateMd } from "./"; 2 | import { existsSync, readFileSync, appendFileSync } from "fs"; 3 | 4 | // Mocking fs and path modules 5 | jest.mock("fs"); 6 | jest.mock("path"); 7 | 8 | describe("getJsonData", () => { 9 | it("should return formatted markdown text from package.json data", () => { 10 | // Setup 11 | existsSync.mockReturnValue(true); 12 | readFileSync.mockReturnValue( 13 | JSON.stringify({ name: "Test Package", description: "A test package" }), 14 | ); 15 | const logMock = { error: jest.fn() }; 16 | 17 | // Execute 18 | const result = getJsonData("some/path", "package.json", logMock); 19 | 20 | // Assert 21 | expect(result).toBe("### Test Package\n\nA test package\n\n"); 22 | }); 23 | 24 | // Add more tests for different scenarios... 25 | }); 26 | 27 | describe("updateMd", () => { 28 | it("should append markdown text to an existing file", () => { 29 | // Setup 30 | existsSync.mockReturnValue(true); 31 | const appendFileSyncMock = appendFileSync.mockImplementation(() => {}); 32 | const markdownText = "### Test Package\n\nA test package\n\n"; 33 | const mdPath = "README.md"; 34 | const logMock = { error: jest.fn() }; 35 | 36 | // Execute 37 | updateMd(markdownText, mdPath, logMock); 38 | 39 | // Assert 40 | expect(appendFileSyncMock).toHaveBeenCalledWith(mdPath, markdownText); 41 | }); 42 | 43 | // Add more tests for different scenarios... 44 | }); 45 | -------------------------------------------------------------------------------- /utilities/new-pkg/src/program.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | import { program } from "commander"; 4 | import inquirer from "inquirer"; 5 | import { script } from "./script"; 6 | import { Input, InputOptions, Options } from "./types"; 7 | const version = "VERSION"; 8 | 9 | export async function getInput({ 10 | name, 11 | message, 12 | }: InputOptions): Promise { 13 | const { name: input = "" }: Input = await inquirer.prompt({ 14 | type: "input", 15 | name, 16 | message, 17 | }); 18 | return input ? input : ""; 19 | } 20 | 21 | /** 22 | * action 23 | * @param {pkgType} string 24 | * @param {Options} options 25 | */ 26 | async function action(options: Options = {}) { 27 | try { 28 | // resolves "name" 29 | const name = options?.name 30 | ? options.name 31 | : await getInput({ 32 | name: "name", 33 | message: "What is the name of the package?", 34 | }); 35 | 36 | // resolves "description" 37 | const description = options?.description 38 | ? options.description 39 | : await getInput({ 40 | name: "description", 41 | message: "What is the description of the package?", 42 | }); 43 | await script({ description, name }); 44 | } catch (err) { 45 | console.error(err); 46 | } 47 | } 48 | 49 | program 50 | .version(version) 51 | .description("creates a new package based on pckType") 52 | .option("-d, --description ", "description of the package") 53 | .option("-n, --name ", "name of the package") 54 | .action(action) 55 | .parse(process.argv); 56 | 57 | export default program; 58 | -------------------------------------------------------------------------------- /utilities/is-object/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import { isObject, isOfObjectType, isArray } from "./index"; 2 | 3 | describe("@common-utilities/", () => { 4 | describe("is-object", () => { 5 | describe("isOfObjectType", () => { 6 | test("array", () => { 7 | const result = isOfObjectType(["test", "test"]); 8 | expect(result).toEqual(true); 9 | }); 10 | test("object", () => { 11 | const result = isOfObjectType({ foo: "test" }); 12 | expect(result).toEqual(true); 13 | }); 14 | test("number", () => { 15 | const result = isOfObjectType(9); 16 | expect(result).toEqual(false); 17 | }); 18 | test("string", () => { 19 | const result = isOfObjectType("string"); 20 | expect(result).toEqual(false); 21 | }); 22 | test("null", () => { 23 | const result = isOfObjectType(null); 24 | expect(result).toEqual(false); 25 | }); 26 | test("undefined", () => { 27 | const result = isOfObjectType(undefined); 28 | expect(result).toEqual(false); 29 | }); 30 | }); 31 | 32 | describe("isObject", () => { 33 | test("false", () => { 34 | const result = isObject(["test", "test"]); 35 | expect(result).toEqual(false); 36 | }); 37 | test("true", () => { 38 | const result = isObject({ foo: "test" }); 39 | expect(result).toEqual(true); 40 | }); 41 | }); 42 | 43 | describe("isArray", () => { 44 | test("true", () => { 45 | const result = isArray(["test", "test"]); 46 | expect(result).toEqual(true); 47 | }); 48 | test("false", () => { 49 | const result = isArray({ foo: "test" }); 50 | expect(result).toEqual(false); 51 | }); 52 | }); 53 | }); 54 | }); 55 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Runtime data 9 | pids 10 | *.pid 11 | *.seed 12 | *.pid.lock 13 | 14 | # Directory for instrumented libs generated by jscoverage/JSCover 15 | lib-cov 16 | 17 | # Coverage directory used by tools like istanbul 18 | coverage 19 | 20 | # nyc test coverage 21 | .nyc_output 22 | 23 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 24 | .grunt 25 | 26 | # Bower dependency directory (https://bower.io/) 27 | bower_components 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # Optional npm cache directory 43 | .npm 44 | 45 | # Optional eslint cache 46 | .eslintcache 47 | 48 | # Optional REPL history 49 | .node_repl_history 50 | 51 | # Output of 'npm pack' 52 | *.tgz 53 | 54 | # Yarn Integrity file 55 | .yarn-integrity 56 | 57 | # dotenv environment variables file 58 | .env 59 | 60 | # next.js build output 61 | .next 62 | 63 | .DS_Store 64 | **/.DS_Store 65 | 66 | package-lock.json 67 | utilities/**/package-lock.json 68 | 69 | dist/ 70 | 71 | utilities/**/dist/ 72 | 73 | .dccache 74 | 75 | index.js 76 | .pnpm-store 77 | .turbo 78 | 79 | # Python 80 | __pycache__/ 81 | *.py[cod] 82 | *$py.class 83 | *.so 84 | .Python 85 | env/ 86 | venv/ 87 | .pytest_cache/ 88 | *.egg-info/ 89 | 90 | # Go 91 | *.exe 92 | *.dll 93 | *.so 94 | *.dylib 95 | *.test 96 | *.out 97 | vendor/ 98 | 99 | # Rust 100 | target/ 101 | Cargo.lock 102 | *.rs.bk 103 | -------------------------------------------------------------------------------- /utilities/wait-until-defined/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * waitUntilDefined ⌚️ 3 | * @param callbackFn 4 | * @param interval 5 | * @param timeout 6 | * @returns Promise 7 | * @note returns promise which returns a boolean before or at a specified time 8 | * @note https://codepen.io/yowainwright/pen/f27a8364abb3d85e0d2e9a53020c2cae 9 | */ 10 | 11 | /** 12 | * wait 13 | * @param timeout 14 | * @returns Promise 15 | * @note adds a delay of a specified time 16 | */ 17 | export const wait = (timeout: number): Promise => 18 | new Promise((resolve) => setTimeout(() => resolve(true), timeout)); 19 | 20 | /** 21 | * isDefined 22 | * @param callbackFn 23 | * @returns Promise 24 | * @note returns a true/false based on a callback function's return value 25 | */ 26 | export const isDefined = (callbackFn: () => boolean): Promise => 27 | new Promise((resolve) => resolve(callbackFn())); 28 | 29 | /** 30 | * checkDefinition 31 | * @param callbackFn 32 | * @param timeout 33 | * @param count 34 | * @returns Promise 35 | * @note returns a promise which returns a boolean or runs the function recursively 36 | */ 37 | export const checkDefinition = async ( 38 | callbackFn: () => boolean, 39 | timeout: number, 40 | count: number, 41 | ): Promise => { 42 | const definition = await isDefined(callbackFn); 43 | if (definition) { 44 | return definition; 45 | } else { 46 | await wait(timeout); 47 | return checkDefinition(callbackFn, timeout, count - 1); 48 | } 49 | }; 50 | 51 | export const waitUntilDefined = async ( 52 | callbackFn: () => boolean, 53 | interval = 100, 54 | timeout = 5000, 55 | ): Promise => { 56 | const count = timeout / interval; 57 | const definition = await checkDefinition(callbackFn, interval, count); 58 | return definition; 59 | }; 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # [Common Utilities](https://yowainwright.gitbook.io/common-utilities/) 🧰 2 | 3 | #### No cruft. No bloat. No dependencies. 4 | 5 | Simple, typed, functional, documented, and tested utility functions for JavaScript, TypeScript, Python, Go, and Rust. 6 | 7 | [~View the docs](https://yowainwright.gitbook.io/common-utilities/) 8 | 9 | --- 10 | 11 | ## Project Structure 12 | 13 | This monorepo contains utilities implemented in multiple languages. Each utility is organized as: 14 | 15 | ``` 16 | utilities/ 17 | ├── [utility-name]/ 18 | │ ├── ts/ # TypeScript implementation 19 | │ ├── py/ # Python implementation 20 | │ ├── go/ # Go implementation 21 | │ └── rust/ # Rust implementation 22 | ``` 23 | 24 | ## Utilities 25 | 26 | Listed below are currently available utilities. More are on the way! 27 | 28 | 29 | 30 | 31 | 32 | --- 33 | 34 | ## Up Next 35 | 36 | Here are 10 less common but useful utilities planned for implementation: 37 | 38 | 1. **memoize** - Cache function results for expensive computations 39 | 2. **chunk** - Split arrays into smaller arrays of specified size 40 | 3. **clamp** - Constrain a number between minimum and maximum values 41 | 4. **retry** - Retry failed operations with exponential backoff 42 | 5. **partition** - Split an array into two based on a predicate function 43 | 6. **zip** - Combine multiple arrays into tuples 44 | 7. **flatten** - Recursively flatten nested arrays to specified depth 45 | 8. **pick** - Create object with only specified properties 46 | 9. **omit** - Create object excluding specified properties 47 | 10. **sleep** - Promise-based delay utility for async operations 48 | 49 | Each utility will be implemented in TypeScript, Python, Go, and Rust following the same patterns as existing utilities. 50 | 51 | --- 52 | 53 | License, [MIT](./LICENSE) 54 | -------------------------------------------------------------------------------- /utilities/merge-objects/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | type Item = unknown; 2 | 3 | /** 4 | * @note helper functions 5 | * @note see `@common-utilities/filter-array`, `@common-utilities/is-object`for detail 6 | */ 7 | const filterArray = (arr: Item[]): Item[] => 8 | arr.filter( 9 | (item: Item, index: number, self: Item[]) => self.indexOf(item) === index, 10 | ); 11 | const isArray = (item: Item): boolean => Array.isArray(item); 12 | const isOfObjectType = (item: Item): boolean => 13 | item !== null && typeof item === "object"; 14 | const isObject = (item: Item): boolean => 15 | isOfObjectType(item) && !isArray(item); 16 | 17 | /** 18 | * @name mergeObjects 19 | * @param {item} probably an object 20 | * @param {otherItem} probably another object 21 | */ 22 | export const mergeObjects = (item: Item, otherItem: Item): Item => { 23 | if ( 24 | (!isObject(item) && !isArray(item)) || 25 | (!isObject(otherItem) && !isArray(otherItem)) 26 | ) { 27 | return item; 28 | } 29 | if (isArray(item) && isArray(otherItem)) { 30 | return filterArray([ 31 | ...(item as Array), 32 | ...(otherItem as Array), 33 | ]); 34 | } 35 | 36 | return filterArray([...Object.keys(item), ...Object.keys(otherItem)]).reduce( 37 | (acc: Record, key: string) => { 38 | if (typeof acc[key] === "undefined") { 39 | acc[key] = otherItem[key]; 40 | } else if (isObject(acc[key]) || isArray(acc[key])) { 41 | acc[key] = 42 | !isPrototypePolluted(key) && mergeObjects(item[key], otherItem[key]); 43 | } else if ( 44 | acc[key] !== otherItem[key] && 45 | typeof otherItem[key] !== "undefined" 46 | ) { 47 | acc[key] = otherItem[key]; 48 | } 49 | return acc; 50 | }, 51 | item, 52 | ); 53 | }; 54 | 55 | /** 56 | * @name isPrototypePolluted 57 | * @param {key} probably a string 58 | */ 59 | const isPrototypePolluted = (key: string) => 60 | ["__proto__", "constructor", "prototype"].includes(key); 61 | 62 | export default mergeObjects; 63 | -------------------------------------------------------------------------------- /utilities/new-pkg/src/script.ts: -------------------------------------------------------------------------------- 1 | import { resolve, dirname } from "path"; 2 | import { fileURLToPath } from "url"; 3 | import fsFns from "fs-extra"; 4 | const { copySync, readFileSync, renameSync, writeFileSync } = fsFns; 5 | import { Options } from "./types"; 6 | const __filename = fileURLToPath(import.meta.url); 7 | const __dirname = dirname(__filename); 8 | 9 | export function writeTextUpdates(name: string, description, dir: string) { 10 | const readmeFile = readFileSync(`${dir}/README.md`, "utf8"); 11 | const readmeUpdate = readmeFile 12 | .replaceAll("NAME", name) 13 | .replaceAll("DESCRIPTION", description); 14 | writeFileSync(`${dir}/README.md`, readmeUpdate); 15 | const camelCaseName = name 16 | .split("-") 17 | .map((e, i) => 18 | i 19 | ? e.charAt(0).toUpperCase() + e.slice(1).toLowerCase() 20 | : e.toLowerCase(), 21 | ) 22 | .join(""); 23 | const indexFile = readFileSync(`${dir}/src/index.ts`, "utf8"); 24 | const indexFileUpdate = indexFile.replaceAll("name", camelCaseName); 25 | writeFileSync(`${dir}/src/index.ts`, indexFileUpdate); 26 | const testFile = readFileSync(`${dir}/src/index.test.ts`, "utf8"); 27 | const testFileUpdate = testFile.replaceAll("name", camelCaseName); 28 | writeFileSync(`${dir}/src/index.test.ts`, testFileUpdate); 29 | } 30 | 31 | /** 32 | * auditSrcsScript 33 | * @param {Object} options 34 | * @param {string} options.name 35 | * @param {string} options.description 36 | * @returns {void} 37 | */ 38 | export async function createPkg({ description, name }: Options = {}) { 39 | if (!name) { 40 | console.log("`Name` is required!"); 41 | process.exit(0); 42 | } 43 | 44 | const newDir = `packages/${name}`; 45 | 46 | // must match to root 47 | const config = resolve(__dirname, "../pkg"); 48 | copySync(config, newDir); 49 | 50 | // write over initial package.json 51 | const pkgJSON = resolve(`${newDir}/pkg-package.json`); 52 | const json = await import(pkgJSON, { assert: { type: "json" } }); 53 | const parsedJSON = JSON.parse(JSON.stringify(json)); 54 | const updatedPakcageJSON = { 55 | ...parsedJSON, 56 | name: `@common-utilities/${name}`, 57 | description, 58 | }; 59 | 60 | writeFileSync( 61 | `${newDir}/package.json`, 62 | JSON.stringify(updatedPakcageJSON, null, 2), 63 | ); 64 | renameSync(`${newDir}/pkg-package.json`, `${newDir}/package.json`); 65 | writeTextUpdates(name, description, newDir); 66 | } 67 | 68 | export const script = createPkg; 69 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | # For most projects, this workflow file will not need changing; you simply need 2 | # to commit it to your repository. 3 | # 4 | # You may wish to alter this file to override the set of languages analyzed, 5 | # or to provide custom queries or build logic. 6 | # 7 | # ******** NOTE ******** 8 | # We have attempted to detect the languages in your repository. Please check 9 | # the `language` matrix defined below to confirm you have the correct set of 10 | # supported CodeQL languages. 11 | # 12 | name: "CodeQL" 13 | 14 | on: 15 | push: 16 | branches: [ master ] 17 | pull_request: 18 | # The branches below must be a subset of the branches above 19 | branches: [ master ] 20 | schedule: 21 | - cron: '43 22 * * 5' 22 | 23 | jobs: 24 | analyze: 25 | name: Analyze 26 | runs-on: ubuntu-latest 27 | permissions: 28 | actions: read 29 | contents: read 30 | security-events: write 31 | 32 | strategy: 33 | fail-fast: false 34 | matrix: 35 | language: [ 'javascript' ] 36 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] 37 | # Learn more: 38 | # https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed 39 | 40 | steps: 41 | - name: Checkout repository 42 | uses: actions/checkout@v2 43 | 44 | # Initializes the CodeQL tools for scanning. 45 | - name: Initialize CodeQL 46 | uses: github/codeql-action/init@v1 47 | with: 48 | languages: ${{ matrix.language }} 49 | # If you wish to specify custom queries, you can do so here or in a config file. 50 | # By default, queries listed here will override any specified in a config file. 51 | # Prefix the list here with "+" to use these queries and those in the config file. 52 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 53 | 54 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 55 | # If this step fails, then you should remove it and run the build manually (see below) 56 | - name: Autobuild 57 | uses: github/codeql-action/autobuild@v1 58 | 59 | # ℹ️ Command-line programs to run using the OS shell. 60 | # 📚 https://git.io/JvXDl 61 | 62 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines 63 | # and modify them (or add more) to build your code if your project 64 | # uses a compiled language 65 | 66 | #- run: | 67 | # make bootstrap 68 | # make release 69 | 70 | - name: Perform CodeQL Analysis 71 | uses: github/codeql-action/analyze@v1 72 | -------------------------------------------------------------------------------- /utilities/merge-objects/ts/src/index.test.ts: -------------------------------------------------------------------------------- 1 | import mergeObjects from "."; 2 | 3 | const testItems = [ 4 | { 5 | lonelyObj1: { 6 | broken: true, 7 | alone: true, 8 | complex: { 9 | cats: true, 10 | dogs: false, 11 | }, 12 | }, 13 | lonelyObj2: { 14 | broken: false, 15 | alone: false, 16 | complex: { 17 | likesCats: true, 18 | }, 19 | }, 20 | expected: { 21 | alone: false, 22 | broken: false, 23 | complex: { cats: true, dogs: false, likesCats: true }, 24 | }, 25 | }, 26 | { 27 | lonelyObj1: { 28 | bummed: true, 29 | depressed: true, 30 | complex: { 31 | cats: false, 32 | dogs: true, 33 | }, 34 | likes: ["home", "yoga"], 35 | }, 36 | lonelyObj2: { 37 | bummed: false, 38 | depressed: false, 39 | complex: { 40 | likesDogs: true, 41 | }, 42 | likes: ["home", "yoga"], 43 | }, 44 | expected: { 45 | bummed: false, 46 | depressed: false, 47 | complex: { cats: false, dogs: true, likesDogs: true }, 48 | likes: ["home", "yoga"], 49 | }, 50 | }, 51 | { 52 | lonelyObj1: { 53 | bummed: true, 54 | depressed: true, 55 | complex: { 56 | cats: false, 57 | dogs: true, 58 | }, 59 | likes: ["home", "yoga"], 60 | person: { 61 | brain: { 62 | thoughts: true, 63 | thoughtTypes: ["easy", "hard"], 64 | }, 65 | bodyPart: [ 66 | { 67 | name: "arm", 68 | }, 69 | { 70 | name: "leg", 71 | }, 72 | ], 73 | }, 74 | }, 75 | lonelyObj2: { 76 | bummed: false, 77 | depressed: false, 78 | complex: { 79 | likesDogs: true, 80 | }, 81 | likes: ["home", "yoga"], 82 | person: { 83 | brain: { 84 | ideas: true, 85 | thoughtTypes: ["small"], 86 | }, 87 | bodyPart: [ 88 | { 89 | name: "arm", 90 | }, 91 | { 92 | name: "hand", 93 | }, 94 | ], 95 | }, 96 | }, 97 | expected: { 98 | bummed: false, 99 | depressed: false, 100 | complex: { cats: false, dogs: true, likesDogs: true }, 101 | likes: ["home", "yoga"], 102 | person: { 103 | brain: { 104 | thoughts: true, 105 | thoughtTypes: ["easy", "hard", "small"], 106 | ideas: true, 107 | }, 108 | bodyPart: [ 109 | { 110 | name: "arm", 111 | }, 112 | { 113 | name: "leg", 114 | }, 115 | { 116 | name: "arm", 117 | }, 118 | { 119 | name: "hand", 120 | }, 121 | ], 122 | }, 123 | }, 124 | }, 125 | ]; 126 | 127 | describe("mergeObjects", () => { 128 | testItems.forEach((obj) => { 129 | test(`test ${obj}`, () => { 130 | const result = mergeObjects(obj.lonelyObj1, obj.lonelyObj2); 131 | expect(result).toEqual(obj.expected); 132 | }); 133 | }); 134 | }); 135 | -------------------------------------------------------------------------------- /utilities/update-markdown-list/ts/src/index.ts: -------------------------------------------------------------------------------- 1 | import { fileURLToPath } from "url"; 2 | import { 3 | statSync, 4 | existsSync, 5 | appendFileSync, 6 | readdirSync, 7 | writeFileSync, 8 | readFileSync, 9 | } from "fs"; 10 | import { dirname, join } from "path"; 11 | 12 | export type LoggerOptions = { 13 | file: string; 14 | isLogging?: boolean; 15 | }; 16 | 17 | export const logger = ({ file, isLogging = false }: LoggerOptions) => ({ 18 | debug: (msg: string, ...args: unknown[]) => { 19 | if (!isLogging) return; 20 | console.debug(`update-md-list:[${file}]: ${msg}`, ...args); 21 | }, 22 | error: (msg: string, ...args: unknown[]) => { 23 | console.error(`update-md-list:[${file}]: ${msg}`, ...args); 24 | }, 25 | }); 26 | 27 | export const processPackages = ( 28 | pkgsDir: string, 29 | md: string, 30 | jsonFile: string, 31 | isLogging = false, 32 | ) => { 33 | const __filename = fileURLToPath(import.meta.url); 34 | const __dirname = dirname(__filename); 35 | const dirs = join(__dirname, pkgsDir); 36 | const mdPath = join(__dirname, md); 37 | 38 | const log = logger({ file: __filename, isLogging }); 39 | 40 | if (!existsSync(dirs)) { 41 | log.error("Packages directory not found."); 42 | return; 43 | } 44 | 45 | if (!existsSync(mdPath)) { 46 | log.error("Markdown file not found."); 47 | return; 48 | } 49 | 50 | const packages = readdirSync(dirs); 51 | packages.forEach((pkg) => updateText(mdPath, jsonFile, log, dirs, pkg)); 52 | 53 | log.debug("README.md has been updated with package details."); 54 | }; 55 | 56 | export const getJsonData = ( 57 | packagePath: string, 58 | jsonFile: string, 59 | log: ReturnType, 60 | ) => { 61 | const packageJsonPath = join(packagePath, jsonFile); 62 | if (!existsSync(packageJsonPath)) { 63 | log.error("package.json not found.", { packageJsonPath }); 64 | return ""; 65 | } 66 | 67 | try { 68 | const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8")); 69 | const name = packageJson.name || "Unnamed package"; 70 | const description = packageJson.description || "No description available"; 71 | return `### ${name}\n\n${description}\n\n`; 72 | } catch (error) { 73 | log.error("Error reading package.json", { error }); 74 | return ""; 75 | } 76 | }; 77 | 78 | export const updateText = ( 79 | mdPath: string, 80 | jsonFile: string, 81 | log: ReturnType, 82 | packagesDir: string, 83 | pkg: string, 84 | ) => { 85 | const path = join(packagesDir, pkg); 86 | if (!statSync(path).isDirectory()) { 87 | log.error("Not a directory.", { path }); 88 | return; 89 | } 90 | const mdText = getJsonData(path, jsonFile, log); 91 | updateMd(mdText, mdPath, log); 92 | }; 93 | 94 | export const updateMd = ( 95 | markdownText: string, 96 | mdPath: string, 97 | log: ReturnType, 98 | ) => { 99 | try { 100 | if (existsSync(mdPath)) { 101 | appendFileSync(mdPath, markdownText); 102 | } else { 103 | writeFileSync(mdPath, markdownText); 104 | } 105 | } catch (error) { 106 | log.error("Error updating Markdown file", { error }); 107 | } 108 | }; 109 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@common-utilities/root", 3 | "version": "0.0.1", 4 | "description": "Common utilities for javascript development 🧰", 5 | "repository": "git@github.com:yowainwright/common-utilities.git", 6 | "author": "Jeff Wainwright (https://jeffry.in)", 7 | "license": "MIT", 8 | "main": "README.md", 9 | "private": true, 10 | "devDependencies": { 11 | "@changesets/cli": "^2.27.1", 12 | "@commitlint/cli": "19.8.1", 13 | "@commitlint/config-conventional": "^19.2.2", 14 | "@commitlint/format": "^19.3.0", 15 | "@commitlint/prompt": "19.8.1", 16 | "@common-utilities/new-pkg": "workspace:*", 17 | "@eslint/js": "^9.1.1", 18 | "@swc/core": "^1.5.0", 19 | "@swc/jest": "0.2.38", 20 | "@types/jest": "29.5.14", 21 | "@types/node": "22.15.29", 22 | "codependence": "^0.3.1", 23 | "commitizen": "4.3.1", 24 | "eslint": "9.28.0", 25 | "eslint-config-prettier": "10.1.5", 26 | "eslint-plugin-prettier": "^5.1.3", 27 | "husky": "9.1.7", 28 | "jest": "29.7.0", 29 | "lint-staged": "16.1.0", 30 | "pastoralist": "1.1.12-beta.5", 31 | "prettier": "3.5.3", 32 | "rimraf": "6.0.1", 33 | "ts-node": "10.9.2", 34 | "ts-toolbelt": "^9.6.0", 35 | "tsconfig-paths": "4.2.0", 36 | "tslib": "2.8.1", 37 | "tsutils": "^3.21.0", 38 | "turbo": "^1.13.2", 39 | "type-fest": "^4.17.0", 40 | "typescript": "5.8.3", 41 | "typescript-eslint": "^7.7.1" 42 | }, 43 | "scripts": { 44 | "build": "turbo run clean && turbo run build", 45 | "create-pkg": "node --es-module-specifier-resolution=node node_modules/@common-utilities/new-pkg/dist", 46 | "ci": "run-s lint:ci test:ci", 47 | "commit-msg": "commitlint --edit $1", 48 | "lint": "pnpm lint:cmd --fix", 49 | "lint:ci": "pnpm lint:cmd", 50 | "lint:cmd": "eslint", 51 | "lint-staged": "npx lint-staged", 52 | "test": "pnpm test:cmd", 53 | "test:ci": "pnpm test:cmd --ci", 54 | "test:cmd": "jest --maxWorkers=4 --noStackTrace --collectCoverage=true", 55 | "commit": "git-cz", 56 | "commit:retry": "git-cz --retry", 57 | "commitmsg": "commitlint -e", 58 | "deploy": "pnpm build && pnpm -r publish", 59 | "prepublishOnly": "pnpm build", 60 | "prepare": "husky", 61 | "release-prep": "changeset", 62 | "release-bumps": "changeset version", 63 | "release-packages": "pnpm prepublishOnly && changeset publish && git push --follow-tags", 64 | "update": "codependence --update", 65 | "check-deps": "pastoralist --debug" 66 | }, 67 | "commitlint": { 68 | "extends": [ 69 | "@commitlint/config-conventional" 70 | ], 71 | "rules": { 72 | "header-max-length": [ 73 | 2, 74 | "always", 75 | 120 76 | ], 77 | "scope-enum": [ 78 | 2, 79 | "always", 80 | [ 81 | "curry", 82 | "root", 83 | "compose", 84 | "debounce", 85 | "head", 86 | "pipe", 87 | "repeat", 88 | "trace", 89 | "filter-array", 90 | "merge-objects", 91 | "is-object", 92 | "string-interpolation", 93 | "kebab-to-camel-string", 94 | "throttle", 95 | "trim-whitespace", 96 | "wait-until-defined", 97 | "rot13", 98 | "snake-to-camel-string" 99 | ] 100 | ], 101 | "type-enum": [ 102 | 2, 103 | "always", 104 | [ 105 | "chore", 106 | "feat", 107 | "fix", 108 | "docs", 109 | "style", 110 | "refactor", 111 | "test", 112 | "release", 113 | "revert" 114 | ] 115 | ] 116 | } 117 | }, 118 | "jest": { 119 | "transform": { 120 | "^.+\\.ts$": "@swc/jest" 121 | } 122 | }, 123 | "lint-staged": { 124 | "*.{ts,json,md}": [ 125 | "pnpm lint" 126 | ], 127 | "*.{ts,tsx}": [ 128 | "jest --bail --findRelatedTests --passWithNoTests" 129 | ] 130 | }, 131 | "pastoralist": { 132 | "appendix": { 133 | "minimist@^1.2.6": { 134 | "dependents": { 135 | "typescript": "minimist@^1.2.8" 136 | } 137 | } 138 | } 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /utilities/new-pkg/pnpm-lock.yaml: -------------------------------------------------------------------------------- 1 | lockfileVersion: 5.4 2 | 3 | specifiers: 4 | '@types/fs-extra': ^11.0.0 5 | '@types/inquirer': ^9.0.0 6 | commander: ^10.0.0 7 | fs-extra: ^11.0.0 8 | inquirer: ^9.0.0 9 | 10 | dependencies: 11 | commander: 10.0.0 12 | fs-extra: 11.1.0 13 | inquirer: 9.1.4 14 | 15 | devDependencies: 16 | '@types/fs-extra': 11.0.1 17 | '@types/inquirer': 9.0.3 18 | 19 | packages: 20 | 21 | /@types/fs-extra/11.0.1: 22 | resolution: {integrity: sha512-MxObHvNl4A69ofaTRU8DFqvgzzv8s9yRtaPPm5gud9HDNvpB3GPQFvNuTWAI59B9huVGV5jXYJwbCsmBsOGYWA==} 23 | dependencies: 24 | '@types/jsonfile': 6.1.1 25 | '@types/node': 18.11.18 26 | dev: true 27 | 28 | /@types/inquirer/9.0.3: 29 | resolution: {integrity: sha512-CzNkWqQftcmk2jaCWdBTf9Sm7xSw4rkI1zpU/Udw3HX5//adEZUIm9STtoRP1qgWj0CWQtJ9UTvqmO2NNjhMJw==} 30 | dependencies: 31 | '@types/through': 0.0.30 32 | rxjs: 7.8.0 33 | dev: true 34 | 35 | /@types/jsonfile/6.1.1: 36 | resolution: {integrity: sha512-GSgiRCVeapDN+3pqA35IkQwasaCh/0YFH5dEF6S88iDvEn901DjOeH3/QPY+XYP1DFzDZPvIvfeEgk+7br5png==} 37 | dependencies: 38 | '@types/node': 18.11.18 39 | dev: true 40 | 41 | /@types/node/18.11.18: 42 | resolution: {integrity: sha512-DHQpWGjyQKSHj3ebjFI/wRKcqQcdR+MoFBygntYOZytCqNfkd2ZC4ARDJ2DQqhjH5p85Nnd3jhUJIXrszFX/JA==} 43 | dev: true 44 | 45 | /@types/through/0.0.30: 46 | resolution: {integrity: sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==} 47 | dependencies: 48 | '@types/node': 18.11.18 49 | dev: true 50 | 51 | /ansi-escapes/6.0.0: 52 | resolution: {integrity: sha512-IG23inYII3dWlU2EyiAiGj6Bwal5GzsgPMwjYGvc1HPE2dgbj4ZB5ToWBKSquKw74nB3TIuOwaI6/jSULzfgrw==} 53 | engines: {node: '>=14.16'} 54 | dependencies: 55 | type-fest: 3.5.3 56 | dev: false 57 | 58 | /ansi-regex/6.0.1: 59 | resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} 60 | engines: {node: '>=12'} 61 | dev: false 62 | 63 | /ansi-styles/6.2.1: 64 | resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} 65 | engines: {node: '>=12'} 66 | dev: false 67 | 68 | /base64-js/1.5.1: 69 | resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} 70 | dev: false 71 | 72 | /bl/5.1.0: 73 | resolution: {integrity: sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==} 74 | dependencies: 75 | buffer: 6.0.3 76 | inherits: 2.0.4 77 | readable-stream: 3.6.0 78 | dev: false 79 | 80 | /buffer/6.0.3: 81 | resolution: {integrity: sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==} 82 | dependencies: 83 | base64-js: 1.5.1 84 | ieee754: 1.2.1 85 | dev: false 86 | 87 | /chalk/5.2.0: 88 | resolution: {integrity: sha512-ree3Gqw/nazQAPuJJEy+avdl7QfZMcUvmHIKgEZkGL+xOBzRvup5Hxo6LHuMceSxOabuJLJm5Yp/92R9eMmMvA==} 89 | engines: {node: ^12.17.0 || ^14.13 || >=16.0.0} 90 | dev: false 91 | 92 | /chardet/0.7.0: 93 | resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==} 94 | dev: false 95 | 96 | /cli-cursor/4.0.0: 97 | resolution: {integrity: sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==} 98 | engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} 99 | dependencies: 100 | restore-cursor: 4.0.0 101 | dev: false 102 | 103 | /cli-spinners/2.7.0: 104 | resolution: {integrity: sha512-qu3pN8Y3qHNgE2AFweciB1IfMnmZ/fsNTEE+NOFjmGB2F/7rLhnhzppvpCnN4FovtP26k8lHyy9ptEbNwWFLzw==} 105 | engines: {node: '>=6'} 106 | dev: false 107 | 108 | /cli-width/4.0.0: 109 | resolution: {integrity: sha512-ZksGS2xpa/bYkNzN3BAw1wEjsLV/ZKOf/CCrJ/QOBsxx6fOARIkwTutxp1XIOIohi6HKmOFjMoK/XaqDVUpEEw==} 110 | engines: {node: '>= 12'} 111 | dev: false 112 | 113 | /clone/1.0.4: 114 | resolution: {integrity: sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==} 115 | engines: {node: '>=0.8'} 116 | dev: false 117 | 118 | /commander/10.0.0: 119 | resolution: {integrity: sha512-zS5PnTI22FIRM6ylNW8G4Ap0IEOyk62fhLSD0+uHRT9McRCLGpkVNvao4bjimpK/GShynyQkFFxHhwMcETmduA==} 120 | engines: {node: '>=14'} 121 | dev: false 122 | 123 | /defaults/1.0.4: 124 | resolution: {integrity: sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==} 125 | dependencies: 126 | clone: 1.0.4 127 | dev: false 128 | 129 | /eastasianwidth/0.2.0: 130 | resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} 131 | dev: false 132 | 133 | /emoji-regex/9.2.2: 134 | resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} 135 | dev: false 136 | 137 | /escape-string-regexp/5.0.0: 138 | resolution: {integrity: sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==} 139 | engines: {node: '>=12'} 140 | dev: false 141 | 142 | /external-editor/3.1.0: 143 | resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==} 144 | engines: {node: '>=4'} 145 | dependencies: 146 | chardet: 0.7.0 147 | iconv-lite: 0.4.24 148 | tmp: 0.0.33 149 | dev: false 150 | 151 | /figures/5.0.0: 152 | resolution: {integrity: sha512-ej8ksPF4x6e5wvK9yevct0UCXh8TTFlWGVLlgjZuoBH1HwjIfKE/IdL5mq89sFA7zELi1VhKpmtDnrs7zWyeyg==} 153 | engines: {node: '>=14'} 154 | dependencies: 155 | escape-string-regexp: 5.0.0 156 | is-unicode-supported: 1.3.0 157 | dev: false 158 | 159 | /fs-extra/11.1.0: 160 | resolution: {integrity: sha512-0rcTq621PD5jM/e0a3EJoGC/1TC5ZBCERW82LQuwfGnCa1V8w7dpYH1yNu+SLb6E5dkeCBzKEyLGlFrnr+dUyw==} 161 | engines: {node: '>=14.14'} 162 | dependencies: 163 | graceful-fs: 4.2.10 164 | jsonfile: 6.1.0 165 | universalify: 2.0.0 166 | dev: false 167 | 168 | /graceful-fs/4.2.10: 169 | resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==} 170 | dev: false 171 | 172 | /iconv-lite/0.4.24: 173 | resolution: {integrity: sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==} 174 | engines: {node: '>=0.10.0'} 175 | dependencies: 176 | safer-buffer: 2.1.2 177 | dev: false 178 | 179 | /ieee754/1.2.1: 180 | resolution: {integrity: sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==} 181 | dev: false 182 | 183 | /inherits/2.0.4: 184 | resolution: {integrity: sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==} 185 | dev: false 186 | 187 | /inquirer/9.1.4: 188 | resolution: {integrity: sha512-9hiJxE5gkK/cM2d1mTEnuurGTAoHebbkX0BYl3h7iEg7FYfuNIom+nDfBCSWtvSnoSrWCeBxqqBZu26xdlJlXA==} 189 | engines: {node: '>=12.0.0'} 190 | dependencies: 191 | ansi-escapes: 6.0.0 192 | chalk: 5.2.0 193 | cli-cursor: 4.0.0 194 | cli-width: 4.0.0 195 | external-editor: 3.1.0 196 | figures: 5.0.0 197 | lodash: 4.17.21 198 | mute-stream: 0.0.8 199 | ora: 6.1.2 200 | run-async: 2.4.1 201 | rxjs: 7.8.0 202 | string-width: 5.1.2 203 | strip-ansi: 7.0.1 204 | through: 2.3.8 205 | wrap-ansi: 8.1.0 206 | dev: false 207 | 208 | /is-interactive/2.0.0: 209 | resolution: {integrity: sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==} 210 | engines: {node: '>=12'} 211 | dev: false 212 | 213 | /is-unicode-supported/1.3.0: 214 | resolution: {integrity: sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==} 215 | engines: {node: '>=12'} 216 | dev: false 217 | 218 | /jsonfile/6.1.0: 219 | resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} 220 | dependencies: 221 | universalify: 2.0.0 222 | optionalDependencies: 223 | graceful-fs: 4.2.10 224 | dev: false 225 | 226 | /lodash/4.17.21: 227 | resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} 228 | dev: false 229 | 230 | /log-symbols/5.1.0: 231 | resolution: {integrity: sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==} 232 | engines: {node: '>=12'} 233 | dependencies: 234 | chalk: 5.2.0 235 | is-unicode-supported: 1.3.0 236 | dev: false 237 | 238 | /mimic-fn/2.1.0: 239 | resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} 240 | engines: {node: '>=6'} 241 | dev: false 242 | 243 | /mute-stream/0.0.8: 244 | resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==} 245 | dev: false 246 | 247 | /onetime/5.1.2: 248 | resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} 249 | engines: {node: '>=6'} 250 | dependencies: 251 | mimic-fn: 2.1.0 252 | dev: false 253 | 254 | /ora/6.1.2: 255 | resolution: {integrity: sha512-EJQ3NiP5Xo94wJXIzAyOtSb0QEIAUu7m8t6UZ9krbz0vAJqr92JpcK/lEXg91q6B9pEGqrykkd2EQplnifDSBw==} 256 | engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} 257 | dependencies: 258 | bl: 5.1.0 259 | chalk: 5.2.0 260 | cli-cursor: 4.0.0 261 | cli-spinners: 2.7.0 262 | is-interactive: 2.0.0 263 | is-unicode-supported: 1.3.0 264 | log-symbols: 5.1.0 265 | strip-ansi: 7.0.1 266 | wcwidth: 1.0.1 267 | dev: false 268 | 269 | /os-tmpdir/1.0.2: 270 | resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==} 271 | engines: {node: '>=0.10.0'} 272 | dev: false 273 | 274 | /readable-stream/3.6.0: 275 | resolution: {integrity: sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==} 276 | engines: {node: '>= 6'} 277 | dependencies: 278 | inherits: 2.0.4 279 | string_decoder: 1.3.0 280 | util-deprecate: 1.0.2 281 | dev: false 282 | 283 | /restore-cursor/4.0.0: 284 | resolution: {integrity: sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==} 285 | engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} 286 | dependencies: 287 | onetime: 5.1.2 288 | signal-exit: 3.0.7 289 | dev: false 290 | 291 | /run-async/2.4.1: 292 | resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==} 293 | engines: {node: '>=0.12.0'} 294 | dev: false 295 | 296 | /rxjs/7.8.0: 297 | resolution: {integrity: sha512-F2+gxDshqmIub1KdvZkaEfGDwLNpPvk9Fs6LD/MyQxNgMds/WH9OdDDXOmxUZpME+iSK3rQCctkL0DYyytUqMg==} 298 | dependencies: 299 | tslib: 2.4.1 300 | 301 | /safe-buffer/5.2.1: 302 | resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} 303 | dev: false 304 | 305 | /safer-buffer/2.1.2: 306 | resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==} 307 | dev: false 308 | 309 | /signal-exit/3.0.7: 310 | resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} 311 | dev: false 312 | 313 | /string-width/5.1.2: 314 | resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} 315 | engines: {node: '>=12'} 316 | dependencies: 317 | eastasianwidth: 0.2.0 318 | emoji-regex: 9.2.2 319 | strip-ansi: 7.0.1 320 | dev: false 321 | 322 | /string_decoder/1.3.0: 323 | resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} 324 | dependencies: 325 | safe-buffer: 5.2.1 326 | dev: false 327 | 328 | /strip-ansi/7.0.1: 329 | resolution: {integrity: sha512-cXNxvT8dFNRVfhVME3JAe98mkXDYN2O1l7jmcwMnOslDeESg1rF/OZMtK0nRAhiari1unG5cD4jG3rapUAkLbw==} 330 | engines: {node: '>=12'} 331 | dependencies: 332 | ansi-regex: 6.0.1 333 | dev: false 334 | 335 | /through/2.3.8: 336 | resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==} 337 | dev: false 338 | 339 | /tmp/0.0.33: 340 | resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==} 341 | engines: {node: '>=0.6.0'} 342 | dependencies: 343 | os-tmpdir: 1.0.2 344 | dev: false 345 | 346 | /tslib/2.4.1: 347 | resolution: {integrity: sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==} 348 | 349 | /type-fest/3.5.3: 350 | resolution: {integrity: sha512-V2+og4j/rWReWvaFrse3s9g2xvUv/K9Azm/xo6CjIuq7oeGqsoimC7+9/A3tfvNcbQf8RPSVj/HV81fB4DJrjA==} 351 | engines: {node: '>=14.16'} 352 | dev: false 353 | 354 | /universalify/2.0.0: 355 | resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} 356 | engines: {node: '>= 10.0.0'} 357 | dev: false 358 | 359 | /util-deprecate/1.0.2: 360 | resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==} 361 | dev: false 362 | 363 | /wcwidth/1.0.1: 364 | resolution: {integrity: sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==} 365 | dependencies: 366 | defaults: 1.0.4 367 | dev: false 368 | 369 | /wrap-ansi/8.1.0: 370 | resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} 371 | engines: {node: '>=12'} 372 | dependencies: 373 | ansi-styles: 6.2.1 374 | string-width: 5.1.2 375 | strip-ansi: 7.0.1 376 | dev: false 377 | --------------------------------------------------------------------------------