pull-request-split-advisor 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +52 -0
- package/README.md +168 -0
- package/dist/ai/config-wizard.js +282 -0
- package/dist/ai/enricher.js +290 -0
- package/dist/ai/prompts.js +231 -0
- package/dist/ai/provider.js +265 -0
- package/dist/cli.js +442 -0
- package/dist/config/config.js +315 -0
- package/dist/config/default-config.js +223 -0
- package/dist/core/blocks.js +145 -0
- package/dist/core/commit-planner.js +273 -0
- package/dist/core/dependency.js +284 -0
- package/dist/core/file-stats.js +341 -0
- package/dist/core/history.js +72 -0
- package/dist/core/planner.js +25 -0
- package/dist/core/scoring.js +166 -0
- package/dist/core/strategy.js +486 -0
- package/dist/git/branch-naming.js +120 -0
- package/dist/git/executor.js +378 -0
- package/dist/git/git.js +239 -0
- package/dist/output/report-styles.generated.js +10 -0
- package/dist/output/report.js +726 -0
- package/dist/output/ui.js +417 -0
- package/dist/shared/constants.js +59 -0
- package/dist/shared/types.js +7 -0
- package/dist/shared/utils.js +73 -0
- package/node_modules/@colors/colors/LICENSE +26 -0
- package/node_modules/@colors/colors/README.md +219 -0
- package/node_modules/@colors/colors/examples/normal-usage.js +83 -0
- package/node_modules/@colors/colors/examples/safe-string.js +80 -0
- package/node_modules/@colors/colors/index.d.ts +136 -0
- package/node_modules/@colors/colors/lib/colors.js +211 -0
- package/node_modules/@colors/colors/lib/custom/trap.js +46 -0
- package/node_modules/@colors/colors/lib/custom/zalgo.js +110 -0
- package/node_modules/@colors/colors/lib/extendStringPrototype.js +110 -0
- package/node_modules/@colors/colors/lib/index.js +13 -0
- package/node_modules/@colors/colors/lib/maps/america.js +10 -0
- package/node_modules/@colors/colors/lib/maps/rainbow.js +12 -0
- package/node_modules/@colors/colors/lib/maps/random.js +11 -0
- package/node_modules/@colors/colors/lib/maps/zebra.js +5 -0
- package/node_modules/@colors/colors/lib/styles.js +95 -0
- package/node_modules/@colors/colors/lib/system/has-flag.js +35 -0
- package/node_modules/@colors/colors/lib/system/supports-colors.js +151 -0
- package/node_modules/@colors/colors/package.json +45 -0
- package/node_modules/@colors/colors/safe.d.ts +48 -0
- package/node_modules/@colors/colors/safe.js +10 -0
- package/node_modules/@colors/colors/themes/generic-logging.js +12 -0
- package/node_modules/ansi-align/LICENSE +13 -0
- package/node_modules/ansi-align/README.md +80 -0
- package/node_modules/ansi-align/index.js +61 -0
- package/node_modules/ansi-align/node_modules/ansi-regex/index.d.ts +37 -0
- package/node_modules/ansi-align/node_modules/ansi-regex/index.js +10 -0
- package/node_modules/ansi-align/node_modules/ansi-regex/license +9 -0
- package/node_modules/ansi-align/node_modules/ansi-regex/package.json +55 -0
- package/node_modules/ansi-align/node_modules/ansi-regex/readme.md +78 -0
- package/node_modules/ansi-align/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
- package/node_modules/ansi-align/node_modules/emoji-regex/README.md +73 -0
- package/node_modules/ansi-align/node_modules/emoji-regex/es2015/index.js +6 -0
- package/node_modules/ansi-align/node_modules/emoji-regex/es2015/text.js +6 -0
- package/node_modules/ansi-align/node_modules/emoji-regex/index.d.ts +23 -0
- package/node_modules/ansi-align/node_modules/emoji-regex/index.js +6 -0
- package/node_modules/ansi-align/node_modules/emoji-regex/package.json +50 -0
- package/node_modules/ansi-align/node_modules/emoji-regex/text.js +6 -0
- package/node_modules/ansi-align/node_modules/string-width/index.d.ts +29 -0
- package/node_modules/ansi-align/node_modules/string-width/index.js +47 -0
- package/node_modules/ansi-align/node_modules/string-width/license +9 -0
- package/node_modules/ansi-align/node_modules/string-width/package.json +56 -0
- package/node_modules/ansi-align/node_modules/string-width/readme.md +50 -0
- package/node_modules/ansi-align/node_modules/strip-ansi/index.d.ts +17 -0
- package/node_modules/ansi-align/node_modules/strip-ansi/index.js +4 -0
- package/node_modules/ansi-align/node_modules/strip-ansi/license +9 -0
- package/node_modules/ansi-align/node_modules/strip-ansi/package.json +54 -0
- package/node_modules/ansi-align/node_modules/strip-ansi/readme.md +46 -0
- package/node_modules/ansi-align/package.json +43 -0
- package/node_modules/ansi-regex/index.d.ts +33 -0
- package/node_modules/ansi-regex/index.js +14 -0
- package/node_modules/ansi-regex/license +9 -0
- package/node_modules/ansi-regex/package.json +61 -0
- package/node_modules/ansi-regex/readme.md +66 -0
- package/node_modules/ansi-styles/index.d.ts +236 -0
- package/node_modules/ansi-styles/index.js +223 -0
- package/node_modules/ansi-styles/license +9 -0
- package/node_modules/ansi-styles/package.json +54 -0
- package/node_modules/ansi-styles/readme.md +173 -0
- package/node_modules/boxen/index.d.ts +267 -0
- package/node_modules/boxen/index.js +376 -0
- package/node_modules/boxen/license +9 -0
- package/node_modules/boxen/package.json +69 -0
- package/node_modules/boxen/readme.md +300 -0
- package/node_modules/camelcase/index.d.ts +102 -0
- package/node_modules/camelcase/index.js +110 -0
- package/node_modules/camelcase/license +9 -0
- package/node_modules/camelcase/package.json +47 -0
- package/node_modules/camelcase/readme.md +135 -0
- package/node_modules/chalk/license +9 -0
- package/node_modules/chalk/package.json +83 -0
- package/node_modules/chalk/readme.md +297 -0
- package/node_modules/chalk/source/index.d.ts +325 -0
- package/node_modules/chalk/source/index.js +225 -0
- package/node_modules/chalk/source/utilities.js +33 -0
- package/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +236 -0
- package/node_modules/chalk/source/vendor/ansi-styles/index.js +223 -0
- package/node_modules/chalk/source/vendor/supports-color/browser.d.ts +1 -0
- package/node_modules/chalk/source/vendor/supports-color/browser.js +34 -0
- package/node_modules/chalk/source/vendor/supports-color/index.d.ts +55 -0
- package/node_modules/chalk/source/vendor/supports-color/index.js +190 -0
- package/node_modules/cli-boxes/boxes.json +82 -0
- package/node_modules/cli-boxes/index.d.ts +127 -0
- package/node_modules/cli-boxes/index.js +6 -0
- package/node_modules/cli-boxes/license +9 -0
- package/node_modules/cli-boxes/package.json +42 -0
- package/node_modules/cli-boxes/readme.md +115 -0
- package/node_modules/cli-table3/LICENSE +21 -0
- package/node_modules/cli-table3/README.md +236 -0
- package/node_modules/cli-table3/index.d.ts +96 -0
- package/node_modules/cli-table3/index.js +1 -0
- package/node_modules/cli-table3/node_modules/ansi-regex/index.d.ts +37 -0
- package/node_modules/cli-table3/node_modules/ansi-regex/index.js +10 -0
- package/node_modules/cli-table3/node_modules/ansi-regex/license +9 -0
- package/node_modules/cli-table3/node_modules/ansi-regex/package.json +55 -0
- package/node_modules/cli-table3/node_modules/ansi-regex/readme.md +78 -0
- package/node_modules/cli-table3/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
- package/node_modules/cli-table3/node_modules/emoji-regex/README.md +73 -0
- package/node_modules/cli-table3/node_modules/emoji-regex/es2015/index.js +6 -0
- package/node_modules/cli-table3/node_modules/emoji-regex/es2015/text.js +6 -0
- package/node_modules/cli-table3/node_modules/emoji-regex/index.d.ts +23 -0
- package/node_modules/cli-table3/node_modules/emoji-regex/index.js +6 -0
- package/node_modules/cli-table3/node_modules/emoji-regex/package.json +50 -0
- package/node_modules/cli-table3/node_modules/emoji-regex/text.js +6 -0
- package/node_modules/cli-table3/node_modules/string-width/index.d.ts +29 -0
- package/node_modules/cli-table3/node_modules/string-width/index.js +47 -0
- package/node_modules/cli-table3/node_modules/string-width/license +9 -0
- package/node_modules/cli-table3/node_modules/string-width/package.json +56 -0
- package/node_modules/cli-table3/node_modules/string-width/readme.md +50 -0
- package/node_modules/cli-table3/node_modules/strip-ansi/index.d.ts +17 -0
- package/node_modules/cli-table3/node_modules/strip-ansi/index.js +4 -0
- package/node_modules/cli-table3/node_modules/strip-ansi/license +9 -0
- package/node_modules/cli-table3/node_modules/strip-ansi/package.json +54 -0
- package/node_modules/cli-table3/node_modules/strip-ansi/readme.md +46 -0
- package/node_modules/cli-table3/package.json +100 -0
- package/node_modules/cli-table3/src/cell.js +409 -0
- package/node_modules/cli-table3/src/debug.js +28 -0
- package/node_modules/cli-table3/src/layout-manager.js +254 -0
- package/node_modules/cli-table3/src/table.js +106 -0
- package/node_modules/cli-table3/src/utils.js +344 -0
- package/node_modules/commander/LICENSE +22 -0
- package/node_modules/commander/Readme.md +1157 -0
- package/node_modules/commander/esm.mjs +16 -0
- package/node_modules/commander/index.js +24 -0
- package/node_modules/commander/lib/argument.js +149 -0
- package/node_modules/commander/lib/command.js +2509 -0
- package/node_modules/commander/lib/error.js +39 -0
- package/node_modules/commander/lib/help.js +520 -0
- package/node_modules/commander/lib/option.js +330 -0
- package/node_modules/commander/lib/suggestSimilar.js +101 -0
- package/node_modules/commander/package-support.json +16 -0
- package/node_modules/commander/package.json +84 -0
- package/node_modules/commander/typings/esm.d.mts +3 -0
- package/node_modules/commander/typings/index.d.ts +969 -0
- package/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
- package/node_modules/emoji-regex/README.md +107 -0
- package/node_modules/emoji-regex/index.d.ts +3 -0
- package/node_modules/emoji-regex/index.js +4 -0
- package/node_modules/emoji-regex/index.mjs +4 -0
- package/node_modules/emoji-regex/package.json +45 -0
- package/node_modules/get-east-asian-width/index.d.ts +60 -0
- package/node_modules/get-east-asian-width/index.js +30 -0
- package/node_modules/get-east-asian-width/license +9 -0
- package/node_modules/get-east-asian-width/lookup-data.js +18 -0
- package/node_modules/get-east-asian-width/lookup.js +135 -0
- package/node_modules/get-east-asian-width/package.json +71 -0
- package/node_modules/get-east-asian-width/readme.md +65 -0
- package/node_modules/get-east-asian-width/utilities.js +24 -0
- package/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
- package/node_modules/is-fullwidth-code-point/index.js +50 -0
- package/node_modules/is-fullwidth-code-point/license +9 -0
- package/node_modules/is-fullwidth-code-point/package.json +42 -0
- package/node_modules/is-fullwidth-code-point/readme.md +39 -0
- package/node_modules/isbinaryfile/LICENSE.txt +22 -0
- package/node_modules/isbinaryfile/README.md +70 -0
- package/node_modules/isbinaryfile/lib/index.d.ts +3 -0
- package/node_modules/isbinaryfile/lib/index.js +256 -0
- package/node_modules/isbinaryfile/package.json +64 -0
- package/node_modules/string-width/index.d.ts +39 -0
- package/node_modules/string-width/index.js +82 -0
- package/node_modules/string-width/license +9 -0
- package/node_modules/string-width/package.json +64 -0
- package/node_modules/string-width/readme.md +66 -0
- package/node_modules/strip-ansi/index.d.ts +15 -0
- package/node_modules/strip-ansi/index.js +19 -0
- package/node_modules/strip-ansi/license +9 -0
- package/node_modules/strip-ansi/package.json +59 -0
- package/node_modules/strip-ansi/readme.md +37 -0
- package/node_modules/type-fest/index.d.ts +178 -0
- package/node_modules/type-fest/license-cc0 +121 -0
- package/node_modules/type-fest/license-mit +9 -0
- package/node_modules/type-fest/package.json +91 -0
- package/node_modules/type-fest/readme.md +1060 -0
- package/node_modules/type-fest/source/all-union-fields.d.ts +88 -0
- package/node_modules/type-fest/source/and.d.ts +25 -0
- package/node_modules/type-fest/source/array-indices.d.ts +23 -0
- package/node_modules/type-fest/source/array-slice.d.ts +109 -0
- package/node_modules/type-fest/source/array-splice.d.ts +99 -0
- package/node_modules/type-fest/source/array-tail.d.ts +76 -0
- package/node_modules/type-fest/source/array-values.d.ts +22 -0
- package/node_modules/type-fest/source/arrayable.d.ts +29 -0
- package/node_modules/type-fest/source/async-return-type.d.ts +23 -0
- package/node_modules/type-fest/source/asyncify.d.ts +32 -0
- package/node_modules/type-fest/source/basic.d.ts +68 -0
- package/node_modules/type-fest/source/camel-case.d.ts +89 -0
- package/node_modules/type-fest/source/camel-cased-properties-deep.d.ts +97 -0
- package/node_modules/type-fest/source/camel-cased-properties.d.ts +43 -0
- package/node_modules/type-fest/source/conditional-except.d.ts +45 -0
- package/node_modules/type-fest/source/conditional-keys.d.ts +47 -0
- package/node_modules/type-fest/source/conditional-pick-deep.d.ts +118 -0
- package/node_modules/type-fest/source/conditional-pick.d.ts +44 -0
- package/node_modules/type-fest/source/conditional-simplify.d.ts +32 -0
- package/node_modules/type-fest/source/delimiter-case.d.ts +78 -0
- package/node_modules/type-fest/source/delimiter-cased-properties-deep.d.ts +106 -0
- package/node_modules/type-fest/source/delimiter-cased-properties.d.ts +46 -0
- package/node_modules/type-fest/source/distributed-omit.d.ts +89 -0
- package/node_modules/type-fest/source/distributed-pick.d.ts +85 -0
- package/node_modules/type-fest/source/empty-object.d.ts +46 -0
- package/node_modules/type-fest/source/enforce-optional.d.ts +47 -0
- package/node_modules/type-fest/source/entries.d.ts +62 -0
- package/node_modules/type-fest/source/entry.d.ts +65 -0
- package/node_modules/type-fest/source/exact.d.ts +68 -0
- package/node_modules/type-fest/source/except.d.ts +108 -0
- package/node_modules/type-fest/source/find-global-type.d.ts +64 -0
- package/node_modules/type-fest/source/fixed-length-array.d.ts +43 -0
- package/node_modules/type-fest/source/get.d.ts +219 -0
- package/node_modules/type-fest/source/global-this.d.ts +21 -0
- package/node_modules/type-fest/source/greater-than-or-equal.d.ts +22 -0
- package/node_modules/type-fest/source/greater-than.d.ts +56 -0
- package/node_modules/type-fest/source/has-optional-keys.d.ts +21 -0
- package/node_modules/type-fest/source/has-readonly-keys.d.ts +21 -0
- package/node_modules/type-fest/source/has-required-keys.d.ts +59 -0
- package/node_modules/type-fest/source/has-writable-keys.d.ts +21 -0
- package/node_modules/type-fest/source/if-any.d.ts +24 -0
- package/node_modules/type-fest/source/if-empty-object.d.ts +26 -0
- package/node_modules/type-fest/source/if-never.d.ts +24 -0
- package/node_modules/type-fest/source/if-null.d.ts +24 -0
- package/node_modules/type-fest/source/if-unknown.d.ts +24 -0
- package/node_modules/type-fest/source/includes.d.ts +22 -0
- package/node_modules/type-fest/source/int-closed-range.d.ts +35 -0
- package/node_modules/type-fest/source/int-range.d.ts +55 -0
- package/node_modules/type-fest/source/internal/array.d.ts +126 -0
- package/node_modules/type-fest/source/internal/characters.d.ts +67 -0
- package/node_modules/type-fest/source/internal/index.d.ts +8 -0
- package/node_modules/type-fest/source/internal/keys.d.ts +97 -0
- package/node_modules/type-fest/source/internal/numeric.d.ts +118 -0
- package/node_modules/type-fest/source/internal/object.d.ts +236 -0
- package/node_modules/type-fest/source/internal/string.d.ts +210 -0
- package/node_modules/type-fest/source/internal/tuple.d.ts +90 -0
- package/node_modules/type-fest/source/internal/type.d.ts +139 -0
- package/node_modules/type-fest/source/invariant-of.d.ts +76 -0
- package/node_modules/type-fest/source/is-any.d.ts +33 -0
- package/node_modules/type-fest/source/is-equal.d.ts +31 -0
- package/node_modules/type-fest/source/is-float.d.ts +41 -0
- package/node_modules/type-fest/source/is-integer.d.ts +58 -0
- package/node_modules/type-fest/source/is-literal.d.ts +296 -0
- package/node_modules/type-fest/source/is-never.d.ts +42 -0
- package/node_modules/type-fest/source/is-null.d.ts +20 -0
- package/node_modules/type-fest/source/is-tuple.d.ts +89 -0
- package/node_modules/type-fest/source/is-unknown.d.ts +52 -0
- package/node_modules/type-fest/source/iterable-element.d.ts +64 -0
- package/node_modules/type-fest/source/join.d.ts +68 -0
- package/node_modules/type-fest/source/jsonifiable.d.ts +37 -0
- package/node_modules/type-fest/source/jsonify.d.ts +122 -0
- package/node_modules/type-fest/source/kebab-case.d.ts +44 -0
- package/node_modules/type-fest/source/kebab-cased-properties-deep.d.ts +63 -0
- package/node_modules/type-fest/source/kebab-cased-properties.d.ts +40 -0
- package/node_modules/type-fest/source/keys-of-union.d.ts +42 -0
- package/node_modules/type-fest/source/last-array-element.d.ts +38 -0
- package/node_modules/type-fest/source/less-than-or-equal.d.ts +22 -0
- package/node_modules/type-fest/source/less-than.d.ts +26 -0
- package/node_modules/type-fest/source/literal-to-primitive-deep.d.ts +36 -0
- package/node_modules/type-fest/source/literal-to-primitive.d.ts +36 -0
- package/node_modules/type-fest/source/literal-union.d.ts +37 -0
- package/node_modules/type-fest/source/merge-deep.d.ts +486 -0
- package/node_modules/type-fest/source/merge-exclusive.d.ts +41 -0
- package/node_modules/type-fest/source/merge.d.ts +48 -0
- package/node_modules/type-fest/source/multidimensional-array.d.ts +44 -0
- package/node_modules/type-fest/source/multidimensional-readonly-array.d.ts +48 -0
- package/node_modules/type-fest/source/non-empty-object.d.ts +35 -0
- package/node_modules/type-fest/source/non-empty-string.d.ts +28 -0
- package/node_modules/type-fest/source/non-empty-tuple.d.ts +21 -0
- package/node_modules/type-fest/source/numeric.d.ts +222 -0
- package/node_modules/type-fest/source/observable-like.d.ts +63 -0
- package/node_modules/type-fest/source/omit-deep.d.ts +167 -0
- package/node_modules/type-fest/source/omit-index-signature.d.ts +95 -0
- package/node_modules/type-fest/source/opaque.d.ts +1 -0
- package/node_modules/type-fest/source/optional-keys-of.d.ts +39 -0
- package/node_modules/type-fest/source/or.d.ts +25 -0
- package/node_modules/type-fest/source/override-properties.d.ts +36 -0
- package/node_modules/type-fest/source/package-json.d.ts +676 -0
- package/node_modules/type-fest/source/partial-deep.d.ts +151 -0
- package/node_modules/type-fest/source/partial-on-undefined-deep.d.ts +78 -0
- package/node_modules/type-fest/source/pascal-case.d.ts +42 -0
- package/node_modules/type-fest/source/pascal-cased-properties-deep.d.ts +62 -0
- package/node_modules/type-fest/source/pascal-cased-properties.d.ts +36 -0
- package/node_modules/type-fest/source/paths.d.ts +262 -0
- package/node_modules/type-fest/source/pick-deep.d.ts +149 -0
- package/node_modules/type-fest/source/pick-index-signature.d.ts +50 -0
- package/node_modules/type-fest/source/primitive.d.ts +13 -0
- package/node_modules/type-fest/source/promisable.d.ts +25 -0
- package/node_modules/type-fest/source/readonly-deep.d.ts +81 -0
- package/node_modules/type-fest/source/readonly-keys-of.d.ts +30 -0
- package/node_modules/type-fest/source/readonly-tuple.d.ts +41 -0
- package/node_modules/type-fest/source/replace.d.ts +85 -0
- package/node_modules/type-fest/source/require-all-or-none.d.ts +51 -0
- package/node_modules/type-fest/source/require-at-least-one.d.ts +47 -0
- package/node_modules/type-fest/source/require-exactly-one.d.ts +45 -0
- package/node_modules/type-fest/source/require-one-or-none.d.ts +46 -0
- package/node_modules/type-fest/source/required-deep.d.ts +78 -0
- package/node_modules/type-fest/source/required-keys-of.d.ts +30 -0
- package/node_modules/type-fest/source/schema.d.ts +114 -0
- package/node_modules/type-fest/source/screaming-snake-case.d.ts +28 -0
- package/node_modules/type-fest/source/set-field-type.d.ts +65 -0
- package/node_modules/type-fest/source/set-non-nullable-deep.d.ts +83 -0
- package/node_modules/type-fest/source/set-non-nullable.d.ts +39 -0
- package/node_modules/type-fest/source/set-optional.d.ts +38 -0
- package/node_modules/type-fest/source/set-parameter-type.d.ts +117 -0
- package/node_modules/type-fest/source/set-readonly.d.ts +39 -0
- package/node_modules/type-fest/source/set-required-deep.d.ts +68 -0
- package/node_modules/type-fest/source/set-required.d.ts +70 -0
- package/node_modules/type-fest/source/set-return-type.d.ts +29 -0
- package/node_modules/type-fest/source/shared-union-fields-deep.d.ts +178 -0
- package/node_modules/type-fest/source/shared-union-fields.d.ts +76 -0
- package/node_modules/type-fest/source/simplify-deep.d.ts +115 -0
- package/node_modules/type-fest/source/simplify.d.ts +58 -0
- package/node_modules/type-fest/source/single-key-object.d.ts +29 -0
- package/node_modules/type-fest/source/snake-case.d.ts +45 -0
- package/node_modules/type-fest/source/snake-cased-properties-deep.d.ts +63 -0
- package/node_modules/type-fest/source/snake-cased-properties.d.ts +40 -0
- package/node_modules/type-fest/source/split.d.ts +88 -0
- package/node_modules/type-fest/source/spread.d.ts +84 -0
- package/node_modules/type-fest/source/string-key-of.d.ts +25 -0
- package/node_modules/type-fest/source/string-repeat.d.ts +47 -0
- package/node_modules/type-fest/source/string-slice.d.ts +37 -0
- package/node_modules/type-fest/source/stringified.d.ts +23 -0
- package/node_modules/type-fest/source/structured-cloneable.d.ts +92 -0
- package/node_modules/type-fest/source/subtract.d.ts +83 -0
- package/node_modules/type-fest/source/sum.d.ts +78 -0
- package/node_modules/type-fest/source/tagged-union.d.ts +51 -0
- package/node_modules/type-fest/source/tagged.d.ts +256 -0
- package/node_modules/type-fest/source/trim.d.ts +27 -0
- package/node_modules/type-fest/source/tsconfig-json.d.ts +1294 -0
- package/node_modules/type-fest/source/tuple-to-object.d.ts +42 -0
- package/node_modules/type-fest/source/tuple-to-union.d.ts +51 -0
- package/node_modules/type-fest/source/typed-array.d.ts +17 -0
- package/node_modules/type-fest/source/undefined-on-partial-deep.d.ts +80 -0
- package/node_modules/type-fest/source/union-to-intersection.d.ts +61 -0
- package/node_modules/type-fest/source/union-to-tuple.d.ts +56 -0
- package/node_modules/type-fest/source/unknown-array.d.ts +25 -0
- package/node_modules/type-fest/source/unknown-map.d.ts +24 -0
- package/node_modules/type-fest/source/unknown-record.d.ts +31 -0
- package/node_modules/type-fest/source/unknown-set.d.ts +24 -0
- package/node_modules/type-fest/source/value-of.d.ts +42 -0
- package/node_modules/type-fest/source/words.d.ts +118 -0
- package/node_modules/type-fest/source/writable-deep.d.ts +83 -0
- package/node_modules/type-fest/source/writable-keys-of.d.ts +33 -0
- package/node_modules/type-fest/source/writable.d.ts +68 -0
- package/node_modules/widest-line/index.d.ts +12 -0
- package/node_modules/widest-line/index.js +11 -0
- package/node_modules/widest-line/license +9 -0
- package/node_modules/widest-line/package.json +60 -0
- package/node_modules/widest-line/readme.md +26 -0
- package/node_modules/wrap-ansi/index.d.ts +41 -0
- package/node_modules/wrap-ansi/index.js +222 -0
- package/node_modules/wrap-ansi/license +9 -0
- package/node_modules/wrap-ansi/package.json +69 -0
- package/node_modules/wrap-ansi/readme.md +75 -0
- package/package.json +78 -0
- package/scripts/postinstall.cjs +122 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
# boxen
|
|
2
|
+
|
|
3
|
+
> Create boxes in the terminal
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install boxen
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import boxen from 'boxen';
|
|
17
|
+
|
|
18
|
+
console.log(boxen('unicorn', {padding: 1}));
|
|
19
|
+
/*
|
|
20
|
+
┌─────────────┐
|
|
21
|
+
│ │
|
|
22
|
+
│ unicorn │
|
|
23
|
+
│ │
|
|
24
|
+
└─────────────┘
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
console.log(boxen('unicorn', {padding: 1, margin: 1, borderStyle: 'double'}));
|
|
28
|
+
/*
|
|
29
|
+
|
|
30
|
+
╔═════════════╗
|
|
31
|
+
║ ║
|
|
32
|
+
║ unicorn ║
|
|
33
|
+
║ ║
|
|
34
|
+
╚═════════════╝
|
|
35
|
+
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
console.log(boxen('unicorns love rainbows', {title: 'magical', titleAlignment: 'center'}));
|
|
39
|
+
/*
|
|
40
|
+
┌────── magical ───────┐
|
|
41
|
+
│unicorns love rainbows│
|
|
42
|
+
└──────────────────────┘
|
|
43
|
+
*/
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## API
|
|
47
|
+
|
|
48
|
+
### boxen(text, options?)
|
|
49
|
+
|
|
50
|
+
#### text
|
|
51
|
+
|
|
52
|
+
Type: `string`
|
|
53
|
+
|
|
54
|
+
Text inside the box.
|
|
55
|
+
|
|
56
|
+
#### options
|
|
57
|
+
|
|
58
|
+
Type: `object`
|
|
59
|
+
|
|
60
|
+
##### borderColor
|
|
61
|
+
|
|
62
|
+
Type: `string`\
|
|
63
|
+
Values: `'black'` `'red'` `'green'` `'yellow'` `'blue'` `'magenta'` `'cyan'` `'white'` `'gray'` or a hex value like `'#ff0000'`
|
|
64
|
+
|
|
65
|
+
Color of the box border.
|
|
66
|
+
|
|
67
|
+
##### borderStyle
|
|
68
|
+
|
|
69
|
+
Type: `string | object`\
|
|
70
|
+
Default: `'single'`\
|
|
71
|
+
Values:
|
|
72
|
+
- `'single'`
|
|
73
|
+
```
|
|
74
|
+
┌───┐
|
|
75
|
+
│foo│
|
|
76
|
+
└───┘
|
|
77
|
+
```
|
|
78
|
+
- `'double'`
|
|
79
|
+
```
|
|
80
|
+
╔═══╗
|
|
81
|
+
║foo║
|
|
82
|
+
╚═══╝
|
|
83
|
+
```
|
|
84
|
+
- `'round'` (`'single'` sides with round corners)
|
|
85
|
+
```
|
|
86
|
+
╭───╮
|
|
87
|
+
│foo│
|
|
88
|
+
╰───╯
|
|
89
|
+
```
|
|
90
|
+
- `'bold'`
|
|
91
|
+
```
|
|
92
|
+
┏━━━┓
|
|
93
|
+
┃foo┃
|
|
94
|
+
┗━━━┛
|
|
95
|
+
```
|
|
96
|
+
- `'singleDouble'` (`'single'` on top and bottom, `'double'` on right and left)
|
|
97
|
+
```
|
|
98
|
+
╓───╖
|
|
99
|
+
║foo║
|
|
100
|
+
╙───╜
|
|
101
|
+
```
|
|
102
|
+
- `'doubleSingle'` (`'double'` on top and bottom, `'single'` on right and left)
|
|
103
|
+
```
|
|
104
|
+
╒═══╕
|
|
105
|
+
│foo│
|
|
106
|
+
╘═══╛
|
|
107
|
+
```
|
|
108
|
+
- `'classic'`
|
|
109
|
+
```
|
|
110
|
+
+---+
|
|
111
|
+
|foo|
|
|
112
|
+
+---+
|
|
113
|
+
```
|
|
114
|
+
- `'arrow'`
|
|
115
|
+
```
|
|
116
|
+
↘↓↓↓↙
|
|
117
|
+
→foo←
|
|
118
|
+
↗↑↑↑↖
|
|
119
|
+
```
|
|
120
|
+
- `'none'`
|
|
121
|
+
```
|
|
122
|
+
foo
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Style of the box border.
|
|
126
|
+
|
|
127
|
+
Can be any of the above predefined styles or an object with the following keys:
|
|
128
|
+
|
|
129
|
+
```js
|
|
130
|
+
{
|
|
131
|
+
topLeft: '+',
|
|
132
|
+
topRight: '+',
|
|
133
|
+
bottomLeft: '+',
|
|
134
|
+
bottomRight: '+',
|
|
135
|
+
top: '-',
|
|
136
|
+
bottom: '-',
|
|
137
|
+
left: '|',
|
|
138
|
+
right: '|'
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
##### dimBorder
|
|
143
|
+
|
|
144
|
+
Type: `boolean`\
|
|
145
|
+
Default: `false`
|
|
146
|
+
|
|
147
|
+
Reduce opacity of the border.
|
|
148
|
+
|
|
149
|
+
##### title
|
|
150
|
+
|
|
151
|
+
Type: `string`
|
|
152
|
+
|
|
153
|
+
Display a title at the top of the box.
|
|
154
|
+
If needed, the box will horizontally expand to fit the title.
|
|
155
|
+
|
|
156
|
+
Example:
|
|
157
|
+
```js
|
|
158
|
+
console.log(boxen('foo bar', {title: 'example'}));
|
|
159
|
+
/*
|
|
160
|
+
┌ example ┐
|
|
161
|
+
│foo bar │
|
|
162
|
+
└─────────┘
|
|
163
|
+
*/
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
##### titleAlignment
|
|
167
|
+
|
|
168
|
+
Type: `string`\
|
|
169
|
+
Default: `'left'`
|
|
170
|
+
|
|
171
|
+
Align the title in the top bar.
|
|
172
|
+
|
|
173
|
+
Values:
|
|
174
|
+
- `'left'`
|
|
175
|
+
```js
|
|
176
|
+
/*
|
|
177
|
+
┌ example ──────┐
|
|
178
|
+
│foo bar foo bar│
|
|
179
|
+
└───────────────┘
|
|
180
|
+
*/
|
|
181
|
+
```
|
|
182
|
+
- `'center'`
|
|
183
|
+
```js
|
|
184
|
+
/*
|
|
185
|
+
┌─── example ───┐
|
|
186
|
+
│foo bar foo bar│
|
|
187
|
+
└───────────────┘
|
|
188
|
+
*/
|
|
189
|
+
```
|
|
190
|
+
- `'right'`
|
|
191
|
+
```js
|
|
192
|
+
/*
|
|
193
|
+
┌────── example ┐
|
|
194
|
+
│foo bar foo bar│
|
|
195
|
+
└───────────────┘
|
|
196
|
+
*/
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
##### width
|
|
200
|
+
|
|
201
|
+
Type: `number`
|
|
202
|
+
|
|
203
|
+
Set a fixed width for the box.
|
|
204
|
+
|
|
205
|
+
*Note:* This disables terminal overflow handling and may cause the box to look broken if the user's terminal is not wide enough.
|
|
206
|
+
|
|
207
|
+
```js
|
|
208
|
+
import boxen from 'boxen';
|
|
209
|
+
|
|
210
|
+
console.log(boxen('foo bar', {width: 15}));
|
|
211
|
+
// ┌─────────────┐
|
|
212
|
+
// │foo bar │
|
|
213
|
+
// └─────────────┘
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
##### height
|
|
217
|
+
|
|
218
|
+
Type: `number`
|
|
219
|
+
|
|
220
|
+
Set a fixed height for the box.
|
|
221
|
+
|
|
222
|
+
*Note:* This option will crop overflowing content.
|
|
223
|
+
|
|
224
|
+
```js
|
|
225
|
+
import boxen from 'boxen';
|
|
226
|
+
|
|
227
|
+
console.log(boxen('foo bar', {height: 5}));
|
|
228
|
+
// ┌───────┐
|
|
229
|
+
// │foo bar│
|
|
230
|
+
// │ │
|
|
231
|
+
// │ │
|
|
232
|
+
// └───────┘
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
##### fullscreen
|
|
236
|
+
|
|
237
|
+
Type: `boolean | (width: number, height: number) => [width: number, height: number]`
|
|
238
|
+
|
|
239
|
+
Whether or not to fit all available space within the terminal.
|
|
240
|
+
|
|
241
|
+
Pass a callback function to control box dimensions:
|
|
242
|
+
|
|
243
|
+
```js
|
|
244
|
+
import boxen from 'boxen';
|
|
245
|
+
|
|
246
|
+
console.log(boxen('foo bar', {
|
|
247
|
+
fullscreen: (width, height) => [width, height - 1],
|
|
248
|
+
}));
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
##### padding
|
|
252
|
+
|
|
253
|
+
Type: `number | object`\
|
|
254
|
+
Default: `0`
|
|
255
|
+
|
|
256
|
+
Space between the text and box border.
|
|
257
|
+
|
|
258
|
+
Accepts a number or an object with any of the `top`, `right`, `bottom`, `left` properties. When a number is specified, the left/right padding is 3 times the top/bottom to make it look nice.
|
|
259
|
+
|
|
260
|
+
##### margin
|
|
261
|
+
|
|
262
|
+
Type: `number | object`\
|
|
263
|
+
Default: `0`
|
|
264
|
+
|
|
265
|
+
Space around the box.
|
|
266
|
+
|
|
267
|
+
Accepts a number or an object with any of the `top`, `right`, `bottom`, `left` properties. When a number is specified, the left/right margin is 3 times the top/bottom to make it look nice.
|
|
268
|
+
|
|
269
|
+
##### float
|
|
270
|
+
|
|
271
|
+
Type: `string`\
|
|
272
|
+
Default: `'left'`\
|
|
273
|
+
Values: `'right'` `'center'` `'left'`
|
|
274
|
+
|
|
275
|
+
Float the box on the available terminal screen space.
|
|
276
|
+
|
|
277
|
+
##### backgroundColor
|
|
278
|
+
|
|
279
|
+
Type: `string`\
|
|
280
|
+
Values: `'black'` `'red'` `'green'` `'yellow'` `'blue'` `'magenta'` `'cyan'` `'white'` `'gray'` or a hex value like `'#ff0000'`
|
|
281
|
+
|
|
282
|
+
Color of the background.
|
|
283
|
+
|
|
284
|
+
##### textAlignment
|
|
285
|
+
|
|
286
|
+
Type: `string`\
|
|
287
|
+
Default: `'left'`\
|
|
288
|
+
Values: `'left'` `'center'` `'right'`
|
|
289
|
+
|
|
290
|
+
Align the text in the box based on the widest line.
|
|
291
|
+
|
|
292
|
+
## Maintainer
|
|
293
|
+
|
|
294
|
+
- [Sindre Sorhus](https://github.com/sindresorhus)
|
|
295
|
+
- [Caesarovich](https://github.com/Caesarovich)
|
|
296
|
+
|
|
297
|
+
## Related
|
|
298
|
+
|
|
299
|
+
- [boxen-cli](https://github.com/sindresorhus/boxen-cli) - CLI for this module
|
|
300
|
+
- [cli-boxes](https://github.com/sindresorhus/cli-boxes) - Boxes for use in the terminal
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export type Options = {
|
|
2
|
+
/**
|
|
3
|
+
Uppercase the first character: `foo-bar` → `FooBar`.
|
|
4
|
+
|
|
5
|
+
@default false
|
|
6
|
+
*/
|
|
7
|
+
readonly pascalCase?: boolean;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
Preserve consecutive uppercase characters: `foo-BAR` → `FooBAR`.
|
|
11
|
+
|
|
12
|
+
@default false
|
|
13
|
+
*/
|
|
14
|
+
readonly preserveConsecutiveUppercase?: boolean;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
The locale parameter indicates the locale to be used to convert to upper/lower case according to any locale-specific case mappings. If multiple locales are given in an array, the best available locale is used.
|
|
18
|
+
|
|
19
|
+
Setting `locale: false` ignores the platform locale and uses the [Unicode Default Case Conversion](https://unicode-org.github.io/icu/userguide/transforms/casemappings.html#simple-single-character-case-mapping) algorithm.
|
|
20
|
+
|
|
21
|
+
Default: The host environment’s current locale.
|
|
22
|
+
|
|
23
|
+
@example
|
|
24
|
+
```
|
|
25
|
+
import camelCase from 'camelcase';
|
|
26
|
+
|
|
27
|
+
camelCase('lorem-ipsum', {locale: 'en-US'});
|
|
28
|
+
//=> 'loremIpsum'
|
|
29
|
+
|
|
30
|
+
camelCase('lorem-ipsum', {locale: 'tr-TR'});
|
|
31
|
+
//=> 'loremİpsum'
|
|
32
|
+
|
|
33
|
+
camelCase('lorem-ipsum', {locale: ['en-US', 'en-GB']});
|
|
34
|
+
//=> 'loremIpsum'
|
|
35
|
+
|
|
36
|
+
camelCase('lorem-ipsum', {locale: ['tr', 'TR', 'tr-TR']});
|
|
37
|
+
//=> 'loremİpsum'
|
|
38
|
+
```
|
|
39
|
+
*/
|
|
40
|
+
readonly locale?: false | string | readonly string[];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`.
|
|
45
|
+
|
|
46
|
+
Correctly handles Unicode strings.
|
|
47
|
+
|
|
48
|
+
@param input - The string to convert to camel case.
|
|
49
|
+
|
|
50
|
+
@example
|
|
51
|
+
```
|
|
52
|
+
import camelCase from 'camelcase';
|
|
53
|
+
|
|
54
|
+
camelCase('foo-bar');
|
|
55
|
+
//=> 'fooBar'
|
|
56
|
+
|
|
57
|
+
camelCase('foo_bar');
|
|
58
|
+
//=> 'fooBar'
|
|
59
|
+
|
|
60
|
+
camelCase('Foo-Bar');
|
|
61
|
+
//=> 'fooBar'
|
|
62
|
+
|
|
63
|
+
camelCase('розовый_пушистый_единорог');
|
|
64
|
+
//=> 'розовыйПушистыйЕдинорог'
|
|
65
|
+
|
|
66
|
+
camelCase('Foo-Bar', {pascalCase: true});
|
|
67
|
+
//=> 'FooBar'
|
|
68
|
+
|
|
69
|
+
camelCase('--foo.bar', {pascalCase: false});
|
|
70
|
+
//=> 'fooBar'
|
|
71
|
+
|
|
72
|
+
camelCase('Foo-BAR', {preserveConsecutiveUppercase: true});
|
|
73
|
+
//=> 'fooBAR'
|
|
74
|
+
|
|
75
|
+
camelCase('fooBAR', {pascalCase: true, preserveConsecutiveUppercase: true});
|
|
76
|
+
//=> 'FooBAR'
|
|
77
|
+
|
|
78
|
+
camelCase('foo bar');
|
|
79
|
+
//=> 'fooBar'
|
|
80
|
+
|
|
81
|
+
console.log(process.argv[3]);
|
|
82
|
+
//=> '--foo-bar'
|
|
83
|
+
camelCase(process.argv[3]);
|
|
84
|
+
//=> 'fooBar'
|
|
85
|
+
|
|
86
|
+
camelCase(['foo', 'bar']);
|
|
87
|
+
//=> 'fooBar'
|
|
88
|
+
|
|
89
|
+
camelCase(['__foo__', '--bar'], {pascalCase: true});
|
|
90
|
+
//=> 'FooBar'
|
|
91
|
+
|
|
92
|
+
camelCase(['foo', 'BAR'], {pascalCase: true, preserveConsecutiveUppercase: true})
|
|
93
|
+
//=> 'FooBAR'
|
|
94
|
+
|
|
95
|
+
camelCase('lorem-ipsum', {locale: 'en-US'});
|
|
96
|
+
//=> 'loremIpsum'
|
|
97
|
+
```
|
|
98
|
+
*/
|
|
99
|
+
export default function camelcase(
|
|
100
|
+
input: string | readonly string[],
|
|
101
|
+
options?: Options
|
|
102
|
+
): string;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
const UPPERCASE = /[\p{Lu}]/u;
|
|
2
|
+
const LOWERCASE = /[\p{Ll}]/u;
|
|
3
|
+
const LEADING_CAPITAL = /^[\p{Lu}](?![\p{Lu}])/gu;
|
|
4
|
+
const IDENTIFIER = /([\p{Alpha}\p{N}_]|$)/u;
|
|
5
|
+
const SEPARATORS = /[_.\- ]+/;
|
|
6
|
+
|
|
7
|
+
const LEADING_SEPARATORS = new RegExp('^' + SEPARATORS.source);
|
|
8
|
+
const SEPARATORS_AND_IDENTIFIER = new RegExp(SEPARATORS.source + IDENTIFIER.source, 'gu');
|
|
9
|
+
const NUMBERS_AND_IDENTIFIER = new RegExp('\\d+' + IDENTIFIER.source, 'gu');
|
|
10
|
+
|
|
11
|
+
const preserveCamelCase = (string, toLowerCase, toUpperCase, preserveConsecutiveUppercase) => {
|
|
12
|
+
let isLastCharLower = false;
|
|
13
|
+
let isLastCharUpper = false;
|
|
14
|
+
let isLastLastCharUpper = false;
|
|
15
|
+
let isLastLastCharPreserved = false;
|
|
16
|
+
|
|
17
|
+
for (let index = 0; index < string.length; index++) {
|
|
18
|
+
const character = string[index];
|
|
19
|
+
isLastLastCharPreserved = index > 2 ? string[index - 3] === '-' : true;
|
|
20
|
+
|
|
21
|
+
if (isLastCharLower && UPPERCASE.test(character)) {
|
|
22
|
+
string = string.slice(0, index) + '-' + string.slice(index);
|
|
23
|
+
isLastCharLower = false;
|
|
24
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
25
|
+
isLastCharUpper = true;
|
|
26
|
+
index++;
|
|
27
|
+
} else if (isLastCharUpper && isLastLastCharUpper && LOWERCASE.test(character) && (!isLastLastCharPreserved || preserveConsecutiveUppercase)) {
|
|
28
|
+
string = string.slice(0, index - 1) + '-' + string.slice(index - 1);
|
|
29
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
30
|
+
isLastCharUpper = false;
|
|
31
|
+
isLastCharLower = true;
|
|
32
|
+
} else {
|
|
33
|
+
isLastCharLower = toLowerCase(character) === character && toUpperCase(character) !== character;
|
|
34
|
+
isLastLastCharUpper = isLastCharUpper;
|
|
35
|
+
isLastCharUpper = toUpperCase(character) === character && toLowerCase(character) !== character;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return string;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const preserveConsecutiveUppercase = (input, toLowerCase) => {
|
|
43
|
+
LEADING_CAPITAL.lastIndex = 0;
|
|
44
|
+
|
|
45
|
+
return input.replaceAll(LEADING_CAPITAL, match => toLowerCase(match));
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const postProcess = (input, toUpperCase) => {
|
|
49
|
+
SEPARATORS_AND_IDENTIFIER.lastIndex = 0;
|
|
50
|
+
NUMBERS_AND_IDENTIFIER.lastIndex = 0;
|
|
51
|
+
|
|
52
|
+
return input
|
|
53
|
+
.replaceAll(NUMBERS_AND_IDENTIFIER, (match, pattern, offset) => ['_', '-'].includes(input.charAt(offset + match.length)) ? match : toUpperCase(match))
|
|
54
|
+
.replaceAll(SEPARATORS_AND_IDENTIFIER, (_, identifier) => toUpperCase(identifier));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export default function camelCase(input, options) {
|
|
58
|
+
if (!(typeof input === 'string' || Array.isArray(input))) {
|
|
59
|
+
throw new TypeError('Expected the input to be `string | string[]`');
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
options = {
|
|
63
|
+
pascalCase: false,
|
|
64
|
+
preserveConsecutiveUppercase: false,
|
|
65
|
+
...options,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
if (Array.isArray(input)) {
|
|
69
|
+
input = input.map(x => x.trim())
|
|
70
|
+
.filter(x => x.length)
|
|
71
|
+
.join('-');
|
|
72
|
+
} else {
|
|
73
|
+
input = input.trim();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (input.length === 0) {
|
|
77
|
+
return '';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const toLowerCase = options.locale === false
|
|
81
|
+
? string => string.toLowerCase()
|
|
82
|
+
: string => string.toLocaleLowerCase(options.locale);
|
|
83
|
+
|
|
84
|
+
const toUpperCase = options.locale === false
|
|
85
|
+
? string => string.toUpperCase()
|
|
86
|
+
: string => string.toLocaleUpperCase(options.locale);
|
|
87
|
+
|
|
88
|
+
if (input.length === 1) {
|
|
89
|
+
if (SEPARATORS.test(input)) {
|
|
90
|
+
return '';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return options.pascalCase ? toUpperCase(input) : toLowerCase(input);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const hasUpperCase = input !== toLowerCase(input);
|
|
97
|
+
|
|
98
|
+
if (hasUpperCase) {
|
|
99
|
+
input = preserveCamelCase(input, toLowerCase, toUpperCase, options.preserveConsecutiveUppercase);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
input = input.replace(LEADING_SEPARATORS, '');
|
|
103
|
+
input = options.preserveConsecutiveUppercase ? preserveConsecutiveUppercase(input, toLowerCase) : toLowerCase(input);
|
|
104
|
+
|
|
105
|
+
if (options.pascalCase) {
|
|
106
|
+
input = toUpperCase(input.charAt(0)) + input.slice(1);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return postProcess(input, toUpperCase);
|
|
110
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "camelcase",
|
|
3
|
+
"version": "8.0.0",
|
|
4
|
+
"description": "Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "sindresorhus/camelcase",
|
|
7
|
+
"funding": "https://github.com/sponsors/sindresorhus",
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Sindre Sorhus",
|
|
10
|
+
"email": "sindresorhus@gmail.com",
|
|
11
|
+
"url": "https://sindresorhus.com"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"exports": "./index.js",
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=16"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"test": "xo && ava && tsd"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"index.js",
|
|
24
|
+
"index.d.ts"
|
|
25
|
+
],
|
|
26
|
+
"keywords": [
|
|
27
|
+
"camelcase",
|
|
28
|
+
"camel-case",
|
|
29
|
+
"camel",
|
|
30
|
+
"case",
|
|
31
|
+
"dash",
|
|
32
|
+
"hyphen",
|
|
33
|
+
"dot",
|
|
34
|
+
"underscore",
|
|
35
|
+
"separator",
|
|
36
|
+
"string",
|
|
37
|
+
"text",
|
|
38
|
+
"convert",
|
|
39
|
+
"pascalcase",
|
|
40
|
+
"pascal-case"
|
|
41
|
+
],
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"ava": "^5.3.1",
|
|
44
|
+
"tsd": "^0.28.1",
|
|
45
|
+
"xo": "^0.55.1"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# camelcase
|
|
2
|
+
|
|
3
|
+
> Convert a dash/dot/underscore/space separated string to camelCase or PascalCase: `foo-bar` → `fooBar`
|
|
4
|
+
|
|
5
|
+
Correctly handles Unicode strings.
|
|
6
|
+
|
|
7
|
+
If you use this on untrusted user input, don't forget to limit the length to something reasonable.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install camelcase
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import camelCase from 'camelcase';
|
|
19
|
+
|
|
20
|
+
camelCase('foo-bar');
|
|
21
|
+
//=> 'fooBar'
|
|
22
|
+
|
|
23
|
+
camelCase('foo_bar');
|
|
24
|
+
//=> 'fooBar'
|
|
25
|
+
|
|
26
|
+
camelCase('Foo-Bar');
|
|
27
|
+
//=> 'fooBar'
|
|
28
|
+
|
|
29
|
+
camelCase('розовый_пушистый_единорог');
|
|
30
|
+
//=> 'розовыйПушистыйЕдинорог'
|
|
31
|
+
|
|
32
|
+
camelCase('Foo-Bar', {pascalCase: true});
|
|
33
|
+
//=> 'FooBar'
|
|
34
|
+
|
|
35
|
+
camelCase('--foo.bar', {pascalCase: false});
|
|
36
|
+
//=> 'fooBar'
|
|
37
|
+
|
|
38
|
+
camelCase('Foo-BAR', {preserveConsecutiveUppercase: true});
|
|
39
|
+
//=> 'fooBAR'
|
|
40
|
+
|
|
41
|
+
camelCase('fooBAR', {pascalCase: true, preserveConsecutiveUppercase: true});
|
|
42
|
+
//=> 'FooBAR'
|
|
43
|
+
|
|
44
|
+
camelCase('foo bar');
|
|
45
|
+
//=> 'fooBar'
|
|
46
|
+
|
|
47
|
+
console.log(process.argv[3]);
|
|
48
|
+
//=> '--foo-bar'
|
|
49
|
+
camelCase(process.argv[3]);
|
|
50
|
+
//=> 'fooBar'
|
|
51
|
+
|
|
52
|
+
camelCase(['foo', 'bar']);
|
|
53
|
+
//=> 'fooBar'
|
|
54
|
+
|
|
55
|
+
camelCase(['__foo__', '--bar'], {pascalCase: true});
|
|
56
|
+
//=> 'FooBar'
|
|
57
|
+
|
|
58
|
+
camelCase(['foo', 'BAR'], {pascalCase: true, preserveConsecutiveUppercase: true})
|
|
59
|
+
//=> 'FooBAR'
|
|
60
|
+
|
|
61
|
+
camelCase('lorem-ipsum', {locale: 'en-US'});
|
|
62
|
+
//=> 'loremIpsum'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## API
|
|
66
|
+
|
|
67
|
+
### camelCase(input, options?)
|
|
68
|
+
|
|
69
|
+
#### input
|
|
70
|
+
|
|
71
|
+
Type: `string | string[]`
|
|
72
|
+
|
|
73
|
+
The string to convert to camel case.
|
|
74
|
+
|
|
75
|
+
#### options
|
|
76
|
+
|
|
77
|
+
Type: `object`
|
|
78
|
+
|
|
79
|
+
##### pascalCase
|
|
80
|
+
|
|
81
|
+
Type: `boolean`\
|
|
82
|
+
Default: `false`
|
|
83
|
+
|
|
84
|
+
Uppercase the first character: `foo-bar` → `FooBar`
|
|
85
|
+
|
|
86
|
+
##### preserveConsecutiveUppercase
|
|
87
|
+
|
|
88
|
+
Type: `boolean`\
|
|
89
|
+
Default: `false`
|
|
90
|
+
|
|
91
|
+
Preserve consecutive uppercase characters: `foo-BAR` → `FooBAR`.
|
|
92
|
+
|
|
93
|
+
##### locale
|
|
94
|
+
|
|
95
|
+
Type: `false | string | string[]`\
|
|
96
|
+
Default: The host environment’s current locale.
|
|
97
|
+
|
|
98
|
+
The locale parameter indicates the locale to be used to convert to upper/lower case according to any locale-specific case mappings. If multiple locales are given in an array, the best available locale is used.
|
|
99
|
+
|
|
100
|
+
```js
|
|
101
|
+
import camelCase from 'camelcase';
|
|
102
|
+
|
|
103
|
+
camelCase('lorem-ipsum', {locale: 'en-US'});
|
|
104
|
+
//=> 'loremIpsum'
|
|
105
|
+
|
|
106
|
+
camelCase('lorem-ipsum', {locale: 'tr-TR'});
|
|
107
|
+
//=> 'loremİpsum'
|
|
108
|
+
|
|
109
|
+
camelCase('lorem-ipsum', {locale: ['en-US', 'en-GB']});
|
|
110
|
+
//=> 'loremIpsum'
|
|
111
|
+
|
|
112
|
+
camelCase('lorem-ipsum', {locale: ['tr', 'TR', 'tr-TR']});
|
|
113
|
+
//=> 'loremİpsum'
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Setting `locale: false` ignores the platform locale and uses the [Unicode Default Case Conversion](https://unicode-org.github.io/icu/userguide/transforms/casemappings.html#simple-single-character-case-mapping) algorithm:
|
|
117
|
+
|
|
118
|
+
```js
|
|
119
|
+
import camelCase from 'camelcase';
|
|
120
|
+
|
|
121
|
+
// On a platform with 'tr-TR'
|
|
122
|
+
|
|
123
|
+
camelCase('lorem-ipsum');
|
|
124
|
+
//=> 'loremİpsum'
|
|
125
|
+
|
|
126
|
+
camelCase('lorem-ipsum', {locale: false});
|
|
127
|
+
//=> 'loremIpsum'
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Related
|
|
131
|
+
|
|
132
|
+
- [decamelize](https://github.com/sindresorhus/decamelize) - The inverse of this module
|
|
133
|
+
- [titleize](https://github.com/sindresorhus/titleize) - Capitalize every word in string
|
|
134
|
+
- [humanize-string](https://github.com/sindresorhus/humanize-string) - Convert a camelized/dasherized/underscored string into a humanized one
|
|
135
|
+
- [camelcase-keys](https://github.com/sindresorhus/camelcase-keys) - Convert object keys to camel case
|