@stryke/string-format 0.12.24 → 0.12.26
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/CHANGELOG.md +14 -0
- package/dist/acronyms.cjs +1 -1
- package/dist/acronyms.d.cts +17 -2
- package/dist/acronyms.d.cts.map +1 -0
- package/dist/acronyms.d.mts +17 -2
- package/dist/acronyms.d.mts.map +1 -0
- package/dist/acronyms.mjs +2 -1
- package/dist/acronyms.mjs.map +1 -0
- package/dist/articles.cjs +1 -1
- package/dist/articles.d.cts +5 -2
- package/dist/articles.d.cts.map +1 -0
- package/dist/articles.d.mts +5 -2
- package/dist/articles.d.mts.map +1 -0
- package/dist/articles.mjs +2 -1
- package/dist/articles.mjs.map +1 -0
- package/dist/camel-case.cjs +1 -1
- package/dist/camel-case.d.cts +24 -2
- package/dist/camel-case.d.cts.map +1 -0
- package/dist/camel-case.d.mts +24 -2
- package/dist/camel-case.d.mts.map +1 -0
- package/dist/camel-case.mjs +2 -1
- package/dist/camel-case.mjs.map +1 -0
- package/dist/combine.cjs +1 -1
- package/dist/combine.d.cts +12 -2
- package/dist/combine.d.cts.map +1 -0
- package/dist/combine.d.mts +12 -2
- package/dist/combine.d.mts.map +1 -0
- package/dist/combine.mjs +2 -1
- package/dist/combine.mjs.map +1 -0
- package/dist/conjunctions.cjs +1 -1
- package/dist/conjunctions.d.cts +5 -2
- package/dist/conjunctions.d.cts.map +1 -0
- package/dist/conjunctions.d.mts +5 -2
- package/dist/conjunctions.d.mts.map +1 -0
- package/dist/conjunctions.mjs +2 -1
- package/dist/conjunctions.mjs.map +1 -0
- package/dist/constant-case.cjs +1 -1
- package/dist/constant-case.d.cts +24 -2
- package/dist/constant-case.d.cts.map +1 -0
- package/dist/constant-case.d.mts +24 -2
- package/dist/constant-case.d.mts.map +1 -0
- package/dist/constant-case.mjs +2 -1
- package/dist/constant-case.mjs.map +1 -0
- package/dist/deburr.cjs +1 -1
- package/dist/deburr.d.cts +24 -2
- package/dist/deburr.d.cts.map +1 -0
- package/dist/deburr.d.mts +24 -2
- package/dist/deburr.d.mts.map +1 -0
- package/dist/deburr.mjs +2 -1
- package/dist/deburr.mjs.map +1 -0
- package/dist/decamelize.cjs +1 -1
- package/dist/decamelize.d.cts +11 -2
- package/dist/decamelize.d.cts.map +1 -0
- package/dist/decamelize.d.mts +11 -2
- package/dist/decamelize.d.mts.map +1 -0
- package/dist/decamelize.mjs +2 -1
- package/dist/decamelize.mjs.map +1 -0
- package/dist/escape.cjs +1 -1
- package/dist/escape.d.cts +21 -2
- package/dist/escape.d.cts.map +1 -0
- package/dist/escape.d.mts +21 -2
- package/dist/escape.d.mts.map +1 -0
- package/dist/escape.mjs +2 -1
- package/dist/escape.mjs.map +1 -0
- package/dist/format-special-cases.cjs +1 -1
- package/dist/format-special-cases.d.cts +23 -2
- package/dist/format-special-cases.d.cts.map +1 -0
- package/dist/format-special-cases.d.mts +23 -2
- package/dist/format-special-cases.d.mts.map +1 -0
- package/dist/format-special-cases.mjs +2 -1
- package/dist/format-special-cases.mjs.map +1 -0
- package/dist/get-words.cjs +1 -1
- package/dist/get-words.d.cts +47 -2
- package/dist/get-words.d.cts.map +1 -0
- package/dist/get-words.d.mts +47 -2
- package/dist/get-words.d.mts.map +1 -0
- package/dist/get-words.mjs +2 -1
- package/dist/get-words.mjs.map +1 -0
- package/dist/{deburr-Ct9BIF1O.mjs → helpers/src/remove-accents.cjs} +1 -2
- package/dist/{deburr-ulWvJuGq.cjs → helpers/src/remove-accents.mjs} +2 -1
- package/dist/helpers/src/remove-accents.mjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +27 -27
- package/dist/index.d.mts +27 -27
- package/dist/index.mjs +1 -1
- package/dist/kebab-case.cjs +1 -1
- package/dist/kebab-case.d.cts +24 -2
- package/dist/kebab-case.d.cts.map +1 -0
- package/dist/kebab-case.d.mts +24 -2
- package/dist/kebab-case.d.mts.map +1 -0
- package/dist/kebab-case.mjs +2 -1
- package/dist/kebab-case.mjs.map +1 -0
- package/dist/lower-case-first.cjs +1 -1
- package/dist/lower-case-first.d.cts +14 -2
- package/dist/lower-case-first.d.cts.map +1 -0
- package/dist/lower-case-first.d.mts +14 -2
- package/dist/lower-case-first.d.mts.map +1 -0
- package/dist/lower-case-first.mjs +2 -1
- package/dist/lower-case-first.mjs.map +1 -0
- package/dist/normalize-email.cjs +1 -1
- package/dist/normalize-email.d.cts +20 -2
- package/dist/normalize-email.d.cts.map +1 -0
- package/dist/normalize-email.d.mts +20 -2
- package/dist/normalize-email.d.mts.map +1 -0
- package/dist/normalize-email.mjs +2 -1
- package/dist/normalize-email.mjs.map +1 -0
- package/dist/package.cjs +1 -1
- package/dist/package.d.cts +112 -2
- package/dist/package.d.cts.map +1 -0
- package/dist/package.d.mts +112 -2
- package/dist/package.d.mts.map +1 -0
- package/dist/package.mjs +2 -1
- package/dist/package.mjs.map +1 -0
- package/dist/pad.cjs +1 -1
- package/dist/pad.d.cts +22 -2
- package/dist/pad.d.cts.map +1 -0
- package/dist/pad.d.mts +22 -2
- package/dist/pad.d.mts.map +1 -0
- package/dist/pad.mjs +2 -1
- package/dist/pad.mjs.map +1 -0
- package/dist/pascal-case.cjs +1 -1
- package/dist/pascal-case.d.cts +24 -2
- package/dist/pascal-case.d.cts.map +1 -0
- package/dist/pascal-case.d.mts +24 -2
- package/dist/pascal-case.d.mts.map +1 -0
- package/dist/pascal-case.mjs +2 -1
- package/dist/pascal-case.mjs.map +1 -0
- package/dist/period-split.cjs +1 -1
- package/dist/period-split.d.cts +24 -2
- package/dist/period-split.d.cts.map +1 -0
- package/dist/period-split.d.mts +24 -2
- package/dist/period-split.d.mts.map +1 -0
- package/dist/period-split.mjs +2 -1
- package/dist/period-split.mjs.map +1 -0
- package/dist/prepositions.cjs +1 -1
- package/dist/prepositions.d.cts +5 -2
- package/dist/prepositions.d.cts.map +1 -0
- package/dist/prepositions.d.mts +5 -2
- package/dist/prepositions.d.mts.map +1 -0
- package/dist/prepositions.mjs +2 -1
- package/dist/prepositions.mjs.map +1 -0
- package/dist/pretty-bytes.cjs +1 -1
- package/dist/pretty-bytes.d.cts +152 -2
- package/dist/pretty-bytes.d.cts.map +1 -0
- package/dist/pretty-bytes.d.mts +152 -2
- package/dist/pretty-bytes.d.mts.map +1 -0
- package/dist/pretty-bytes.mjs +2 -1
- package/dist/pretty-bytes.mjs.map +1 -0
- package/dist/snake-case.cjs +1 -1
- package/dist/snake-case.d.cts +28 -2
- package/dist/snake-case.d.cts.map +1 -0
- package/dist/snake-case.d.mts +28 -2
- package/dist/snake-case.d.mts.map +1 -0
- package/dist/snake-case.mjs +2 -1
- package/dist/snake-case.mjs.map +1 -0
- package/dist/special-cases.cjs +1 -1
- package/dist/special-cases.d.cts +5 -2
- package/dist/special-cases.d.cts.map +1 -0
- package/dist/special-cases.d.mts +5 -2
- package/dist/special-cases.d.mts.map +1 -0
- package/dist/special-cases.mjs +2 -1
- package/dist/special-cases.mjs.map +1 -0
- package/dist/start-case.cjs +1 -1
- package/dist/start-case.d.cts +32 -2
- package/dist/start-case.d.cts.map +1 -0
- package/dist/start-case.d.mts +32 -2
- package/dist/start-case.d.mts.map +1 -0
- package/dist/start-case.mjs +2 -1
- package/dist/start-case.mjs.map +1 -0
- package/dist/strip-indents.cjs +3 -1
- package/dist/strip-indents.d.cts +21 -2
- package/dist/strip-indents.d.cts.map +1 -0
- package/dist/strip-indents.d.mts +21 -2
- package/dist/strip-indents.d.mts.map +1 -0
- package/dist/strip-indents.mjs +4 -1
- package/dist/strip-indents.mjs.map +1 -0
- package/dist/title-case.cjs +1 -1
- package/dist/title-case.d.cts +15 -2
- package/dist/title-case.d.cts.map +1 -0
- package/dist/title-case.d.mts +15 -2
- package/dist/title-case.d.mts.map +1 -0
- package/dist/title-case.mjs +2 -1
- package/dist/title-case.mjs.map +1 -0
- package/dist/types/src/base.cjs +1 -0
- package/dist/types/src/base.mjs +2 -0
- package/dist/types/src/base.mjs.map +1 -0
- package/dist/unescape.cjs +1 -1
- package/dist/unescape.d.cts +20 -2
- package/dist/unescape.d.cts.map +1 -0
- package/dist/unescape.d.mts +20 -2
- package/dist/unescape.d.mts.map +1 -0
- package/dist/unescape.mjs +2 -1
- package/dist/unescape.mjs.map +1 -0
- package/dist/upper-case-first.cjs +1 -1
- package/dist/upper-case-first.d.cts +14 -2
- package/dist/upper-case-first.d.cts.map +1 -0
- package/dist/upper-case-first.d.mts +14 -2
- package/dist/upper-case-first.d.mts.map +1 -0
- package/dist/upper-case-first.mjs +2 -1
- package/dist/upper-case-first.mjs.map +1 -0
- package/package.json +3 -3
- package/dist/acronyms-Clf_sxuQ.d.mts +0 -17
- package/dist/acronyms-Clf_sxuQ.d.mts.map +0 -1
- package/dist/acronyms-CqHURYjd.mjs +0 -2
- package/dist/acronyms-CqHURYjd.mjs.map +0 -1
- package/dist/acronyms-D4QIJv0a.d.cts +0 -17
- package/dist/acronyms-D4QIJv0a.d.cts.map +0 -1
- package/dist/acronyms-DiyHB1FK.cjs +0 -1
- package/dist/articles-Cla7DH2n.d.mts +0 -5
- package/dist/articles-Cla7DH2n.d.mts.map +0 -1
- package/dist/articles-D9xvmhoM.cjs +0 -1
- package/dist/articles-DzjpMs-D.d.cts +0 -5
- package/dist/articles-DzjpMs-D.d.cts.map +0 -1
- package/dist/articles-Dzsbtfwj.mjs +0 -2
- package/dist/articles-Dzsbtfwj.mjs.map +0 -1
- package/dist/base-BHbehXQX.mjs +0 -2
- package/dist/base-BHbehXQX.mjs.map +0 -1
- package/dist/base-DdjslzIj.cjs +0 -1
- package/dist/camel-case-BjbgGrxH.d.mts +0 -24
- package/dist/camel-case-BjbgGrxH.d.mts.map +0 -1
- package/dist/camel-case-C05avVyv.cjs +0 -1
- package/dist/camel-case-CZhC2BRe.d.cts +0 -24
- package/dist/camel-case-CZhC2BRe.d.cts.map +0 -1
- package/dist/camel-case-GuOpCLmz.mjs +0 -2
- package/dist/camel-case-GuOpCLmz.mjs.map +0 -1
- package/dist/combine-CAxhmyey.mjs +0 -2
- package/dist/combine-CAxhmyey.mjs.map +0 -1
- package/dist/combine-DZZlBlm_.d.cts +0 -12
- package/dist/combine-DZZlBlm_.d.cts.map +0 -1
- package/dist/combine-PAQYt88F.cjs +0 -1
- package/dist/combine-g1cpXeuj.d.mts +0 -12
- package/dist/combine-g1cpXeuj.d.mts.map +0 -1
- package/dist/conjunctions-B7prVj02.d.mts +0 -5
- package/dist/conjunctions-B7prVj02.d.mts.map +0 -1
- package/dist/conjunctions-CWyOkdmq.mjs +0 -2
- package/dist/conjunctions-CWyOkdmq.mjs.map +0 -1
- package/dist/conjunctions-CaM47PDl.cjs +0 -1
- package/dist/conjunctions-Chb943kG.d.cts +0 -5
- package/dist/conjunctions-Chb943kG.d.cts.map +0 -1
- package/dist/constant-case-B0oTEBjC.cjs +0 -1
- package/dist/constant-case-Cn0OS_D5.mjs +0 -2
- package/dist/constant-case-Cn0OS_D5.mjs.map +0 -1
- package/dist/constant-case-m6XLIpEZ.d.mts +0 -24
- package/dist/constant-case-m6XLIpEZ.d.mts.map +0 -1
- package/dist/constant-case-w4mBqXc4.d.cts +0 -24
- package/dist/constant-case-w4mBqXc4.d.cts.map +0 -1
- package/dist/deburr-Bc41oTWI.d.mts +0 -24
- package/dist/deburr-Bc41oTWI.d.mts.map +0 -1
- package/dist/deburr-Brmq0CIE.d.cts +0 -24
- package/dist/deburr-Brmq0CIE.d.cts.map +0 -1
- package/dist/deburr-Ct9BIF1O.mjs.map +0 -1
- package/dist/decamelize-CO4-wIwF.cjs +0 -1
- package/dist/decamelize-CXxqH9_o.d.mts +0 -11
- package/dist/decamelize-CXxqH9_o.d.mts.map +0 -1
- package/dist/decamelize-CuI8547m.mjs +0 -2
- package/dist/decamelize-CuI8547m.mjs.map +0 -1
- package/dist/decamelize-esVsRIRg.d.cts +0 -11
- package/dist/decamelize-esVsRIRg.d.cts.map +0 -1
- package/dist/escape-C1LTGJQ1.d.cts +0 -21
- package/dist/escape-C1LTGJQ1.d.cts.map +0 -1
- package/dist/escape-C44shywT.d.mts +0 -21
- package/dist/escape-C44shywT.d.mts.map +0 -1
- package/dist/escape-CRoXgV4v.cjs +0 -1
- package/dist/escape-CydJ1P9x.mjs +0 -2
- package/dist/escape-CydJ1P9x.mjs.map +0 -1
- package/dist/format-special-cases-CuctZ76T.cjs +0 -1
- package/dist/format-special-cases-DLTiwMAS.d.mts +0 -23
- package/dist/format-special-cases-DLTiwMAS.d.mts.map +0 -1
- package/dist/format-special-cases-Db69zjlV.d.cts +0 -23
- package/dist/format-special-cases-Db69zjlV.d.cts.map +0 -1
- package/dist/format-special-cases-F9O32YcB.mjs +0 -2
- package/dist/format-special-cases-F9O32YcB.mjs.map +0 -1
- package/dist/get-words-Cdgu0ngS.d.cts +0 -47
- package/dist/get-words-Cdgu0ngS.d.cts.map +0 -1
- package/dist/get-words-De8YIU0J.d.mts +0 -47
- package/dist/get-words-De8YIU0J.d.mts.map +0 -1
- package/dist/get-words-IF97Rpfr.cjs +0 -1
- package/dist/get-words-vlruPM_Q.mjs +0 -2
- package/dist/get-words-vlruPM_Q.mjs.map +0 -1
- package/dist/kebab-case-CT-vTX1k.mjs +0 -2
- package/dist/kebab-case-CT-vTX1k.mjs.map +0 -1
- package/dist/kebab-case-P86ZRHrn.cjs +0 -1
- package/dist/kebab-case-j61N8v5l.d.cts +0 -24
- package/dist/kebab-case-j61N8v5l.d.cts.map +0 -1
- package/dist/kebab-case-pl--iN9P.d.mts +0 -24
- package/dist/kebab-case-pl--iN9P.d.mts.map +0 -1
- package/dist/lower-case-first-BSnwPTwZ.d.cts +0 -14
- package/dist/lower-case-first-BSnwPTwZ.d.cts.map +0 -1
- package/dist/lower-case-first-CES45S2D.cjs +0 -1
- package/dist/lower-case-first-CVRU3SQT.mjs +0 -2
- package/dist/lower-case-first-CVRU3SQT.mjs.map +0 -1
- package/dist/lower-case-first-_dvT-gH7.d.mts +0 -14
- package/dist/lower-case-first-_dvT-gH7.d.mts.map +0 -1
- package/dist/normalize-email-BGivsxZI.d.cts +0 -20
- package/dist/normalize-email-BGivsxZI.d.cts.map +0 -1
- package/dist/normalize-email-DRezSgOV.cjs +0 -1
- package/dist/normalize-email-bfhnC3KA.d.mts +0 -20
- package/dist/normalize-email-bfhnC3KA.d.mts.map +0 -1
- package/dist/normalize-email-us4o_m-8.mjs +0 -2
- package/dist/normalize-email-us4o_m-8.mjs.map +0 -1
- package/dist/package-BSidq8g2.mjs +0 -2
- package/dist/package-BSidq8g2.mjs.map +0 -1
- package/dist/package-Cw2gkIBD.cjs +0 -1
- package/dist/package-dwE_olpo.d.mts +0 -112
- package/dist/package-dwE_olpo.d.mts.map +0 -1
- package/dist/package-o2QJauB-.d.cts +0 -112
- package/dist/package-o2QJauB-.d.cts.map +0 -1
- package/dist/pad-7O_mbugy.cjs +0 -1
- package/dist/pad-B___Grg_.mjs +0 -2
- package/dist/pad-B___Grg_.mjs.map +0 -1
- package/dist/pad-C-Y_3U-y.d.cts +0 -22
- package/dist/pad-C-Y_3U-y.d.cts.map +0 -1
- package/dist/pad-mujSKqwW.d.mts +0 -22
- package/dist/pad-mujSKqwW.d.mts.map +0 -1
- package/dist/pascal-case-BNtNlP7E.mjs +0 -2
- package/dist/pascal-case-BNtNlP7E.mjs.map +0 -1
- package/dist/pascal-case-BQIXhOgM.cjs +0 -1
- package/dist/pascal-case-DpwdMyIR.d.mts +0 -24
- package/dist/pascal-case-DpwdMyIR.d.mts.map +0 -1
- package/dist/pascal-case-KPXemzHF.d.cts +0 -24
- package/dist/pascal-case-KPXemzHF.d.cts.map +0 -1
- package/dist/period-split-BN6zXi_S.cjs +0 -1
- package/dist/period-split-C2v7R4SQ.d.cts +0 -24
- package/dist/period-split-C2v7R4SQ.d.cts.map +0 -1
- package/dist/period-split-CBVGYrUw.d.mts +0 -24
- package/dist/period-split-CBVGYrUw.d.mts.map +0 -1
- package/dist/period-split-PMoklYb7.mjs +0 -2
- package/dist/period-split-PMoklYb7.mjs.map +0 -1
- package/dist/prepositions-BOeFQ28J.mjs +0 -2
- package/dist/prepositions-BOeFQ28J.mjs.map +0 -1
- package/dist/prepositions-Bp1VMgpn.cjs +0 -1
- package/dist/prepositions-By1zoaRG.d.cts +0 -5
- package/dist/prepositions-By1zoaRG.d.cts.map +0 -1
- package/dist/prepositions-DHokBFOW.d.mts +0 -5
- package/dist/prepositions-DHokBFOW.d.mts.map +0 -1
- package/dist/pretty-bytes-Dam2n54B.d.mts +0 -152
- package/dist/pretty-bytes-Dam2n54B.d.mts.map +0 -1
- package/dist/pretty-bytes-DmvsumO5.mjs +0 -2
- package/dist/pretty-bytes-DmvsumO5.mjs.map +0 -1
- package/dist/pretty-bytes-Dv8t5D6N.d.cts +0 -152
- package/dist/pretty-bytes-Dv8t5D6N.d.cts.map +0 -1
- package/dist/pretty-bytes-aHFwwFbw.cjs +0 -1
- package/dist/snake-case-C5v7aTGP.d.cts +0 -28
- package/dist/snake-case-C5v7aTGP.d.cts.map +0 -1
- package/dist/snake-case-CKf8oDuS.d.mts +0 -28
- package/dist/snake-case-CKf8oDuS.d.mts.map +0 -1
- package/dist/special-cases-Ab3-SD5v.d.cts +0 -5
- package/dist/special-cases-Ab3-SD5v.d.cts.map +0 -1
- package/dist/special-cases-CfBSDTk8.cjs +0 -1
- package/dist/special-cases-D7iFXvkR.d.mts +0 -5
- package/dist/special-cases-D7iFXvkR.d.mts.map +0 -1
- package/dist/special-cases-gNNOSEbK.mjs +0 -2
- package/dist/special-cases-gNNOSEbK.mjs.map +0 -1
- package/dist/start-case-B9JLArn_.d.mts +0 -32
- package/dist/start-case-B9JLArn_.d.mts.map +0 -1
- package/dist/start-case-CbdCqiBN.mjs +0 -2
- package/dist/start-case-CbdCqiBN.mjs.map +0 -1
- package/dist/start-case-ChU_5Pyw.cjs +0 -1
- package/dist/start-case-CsYY3Ed4.d.cts +0 -32
- package/dist/start-case-CsYY3Ed4.d.cts.map +0 -1
- package/dist/strip-indents-CPW83oCs.cjs +0 -3
- package/dist/strip-indents-D2-u4Zmx.mjs +0 -4
- package/dist/strip-indents-D2-u4Zmx.mjs.map +0 -1
- package/dist/strip-indents-DBLDecNL.d.cts +0 -21
- package/dist/strip-indents-DBLDecNL.d.cts.map +0 -1
- package/dist/strip-indents-Dtn3rr-P.d.mts +0 -21
- package/dist/strip-indents-Dtn3rr-P.d.mts.map +0 -1
- package/dist/title-case-B_fyCnko.cjs +0 -1
- package/dist/title-case-Cx3FA_Rw.d.mts +0 -15
- package/dist/title-case-Cx3FA_Rw.d.mts.map +0 -1
- package/dist/title-case-DHhN2pBE.mjs +0 -2
- package/dist/title-case-DHhN2pBE.mjs.map +0 -1
- package/dist/title-case-mvtRcmDU.d.cts +0 -15
- package/dist/title-case-mvtRcmDU.d.cts.map +0 -1
- package/dist/unescape-5MrwINOf.d.cts +0 -20
- package/dist/unescape-5MrwINOf.d.cts.map +0 -1
- package/dist/unescape-9cS7rNT5.d.mts +0 -20
- package/dist/unescape-9cS7rNT5.d.mts.map +0 -1
- package/dist/unescape-CKwnSwBD.mjs +0 -2
- package/dist/unescape-CKwnSwBD.mjs.map +0 -1
- package/dist/unescape-Ck5lwccz.cjs +0 -1
- package/dist/upper-case-first-Bwfq-lAe.d.mts +0 -14
- package/dist/upper-case-first-Bwfq-lAe.d.mts.map +0 -1
- package/dist/upper-case-first-Ca89zvpr.mjs +0 -2
- package/dist/upper-case-first-Ca89zvpr.mjs.map +0 -1
- package/dist/upper-case-first-IJMSoKjS.cjs +0 -1
- package/dist/upper-case-first-uHFwRCJ8.d.cts +0 -14
- package/dist/upper-case-first-uHFwRCJ8.d.cts.map +0 -1
package/dist/period-split.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./
|
|
1
|
+
const e=require(`./types/src/base.cjs`),t=require(`./upper-case-first.cjs`);function n(e){return e?/^[a-z]+(?:\.[a-z0-9]+)*$/.test(e):!1}function r(r){if(!r||n(r))return r;let i=r?.replace(/[A-Z]+/g,n=>t.upperCaseFirst(n)??e.EMPTY_STRING)?.split(/(?=[A-Z])|[\s._-]/).map(e=>e.toLowerCase())??[];return i.length===0?``:i.length===1?i[0]:i.reduce((e,t)=>`${e}.${t.toLowerCase()}`.toLowerCase())}exports.isPeriodSplit=n,exports.periodSplit=r;
|
package/dist/period-split.d.cts
CHANGED
|
@@ -1,2 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/period-split.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Check if the input string is in snake case.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Snake case is defined as all lowercase letters with underscores separating words - "this_is_an_example"
|
|
7
|
+
*
|
|
8
|
+
* @param input - The input string to check.
|
|
9
|
+
* @returns True if the input is in snake case, false otherwise.
|
|
10
|
+
*/
|
|
11
|
+
declare function isPeriodSplit(input: string | undefined): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Make all characters lowercase and add a period in between each word
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* "this.is.an.example"
|
|
17
|
+
*
|
|
18
|
+
* @param input - The input string.
|
|
19
|
+
* @returns The period-split string.
|
|
20
|
+
*/
|
|
21
|
+
declare function periodSplit<T extends string | undefined>(input?: T): T;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { isPeriodSplit, periodSplit };
|
|
24
|
+
//# sourceMappingURL=period-split.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"period-split.d.cts","names":[],"sources":["../src/period-split.ts"],"sourcesContent":[],"mappings":";;AA8BA;AAaA;;;;;;;iBAbgB,aAAA;;;;;;;;;;iBAaA,kDAAkD,IAAI"}
|
package/dist/period-split.d.mts
CHANGED
|
@@ -1,2 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/period-split.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Check if the input string is in snake case.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Snake case is defined as all lowercase letters with underscores separating words - "this_is_an_example"
|
|
7
|
+
*
|
|
8
|
+
* @param input - The input string to check.
|
|
9
|
+
* @returns True if the input is in snake case, false otherwise.
|
|
10
|
+
*/
|
|
11
|
+
declare function isPeriodSplit(input: string | undefined): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Make all characters lowercase and add a period in between each word
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* "this.is.an.example"
|
|
17
|
+
*
|
|
18
|
+
* @param input - The input string.
|
|
19
|
+
* @returns The period-split string.
|
|
20
|
+
*/
|
|
21
|
+
declare function periodSplit<T extends string | undefined>(input?: T): T;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { isPeriodSplit, periodSplit };
|
|
24
|
+
//# sourceMappingURL=period-split.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"period-split.d.mts","names":[],"sources":["../src/period-split.ts"],"sourcesContent":[],"mappings":";;AA8BA;AAaA;;;;;;;iBAbgB,aAAA;;;;;;;;;;iBAaA,kDAAkD,IAAI"}
|
package/dist/period-split.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{EMPTY_STRING as e}from"./types/src/base.mjs";import{upperCaseFirst as t}from"./upper-case-first.mjs";function n(e){return e?/^[a-z]+(?:\.[a-z0-9]+)*$/.test(e):!1}function r(r){if(!r||n(r))return r;let i=r?.replace(/[A-Z]+/g,n=>t(n)??e)?.split(/(?=[A-Z])|[\s._-]/).map(e=>e.toLowerCase())??[];return i.length===0?``:i.length===1?i[0]:i.reduce((e,t)=>`${e}.${t.toLowerCase()}`.toLowerCase())}export{n as isPeriodSplit,r as periodSplit};
|
|
2
|
+
//# sourceMappingURL=period-split.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"period-split.mjs","names":["input"],"sources":["../src/period-split.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { EMPTY_STRING } from \"@stryke/types\";\nimport { upperCaseFirst } from \"./upper-case-first\";\n\n/**\n * Check if the input string is in snake case.\n *\n * @remarks\n * Snake case is defined as all lowercase letters with underscores separating words - \"this_is_an_example\"\n *\n * @param input - The input string to check.\n * @returns True if the input is in snake case, false otherwise.\n */\nexport function isPeriodSplit(input: string | undefined): boolean {\n return input ? /^[a-z]+(?:\\.[a-z0-9]+)*$/.test(input) : false;\n}\n\n/**\n * Make all characters lowercase and add a period in between each word\n *\n * @remarks\n * \"this.is.an.example\"\n *\n * @param input - The input string.\n * @returns The period-split string.\n */\nexport function periodSplit<T extends string | undefined>(input?: T): T {\n if (!input || isPeriodSplit(input)) {\n return input as T;\n }\n\n const parts =\n input\n ?.replace(\n /[A-Z]+/g,\n (input?: string) => upperCaseFirst(input) ?? EMPTY_STRING\n )\n ?.split(/(?=[A-Z])|[\\s._-]/)\n .map(x => x.toLowerCase()) ?? [];\n if (parts.length === 0) {\n return \"\" as T;\n }\n if (parts.length === 1) {\n return parts[0] as T;\n }\n\n return parts.reduce((ret: string, part: string) => {\n return `${ret}.${part.toLowerCase()}`.toLowerCase();\n }) as T;\n}\n"],"mappings":"4GA8BA,SAAgB,EAAc,EAAoC,CAChE,OAAO,EAAQ,2BAA2B,KAAK,EAAM,CAAG,GAY1D,SAAgB,EAA0C,EAAc,CACtE,GAAI,CAAC,GAAS,EAAc,EAAM,CAChC,OAAO,EAGT,IAAM,EACJ,GACI,QACA,UACC,GAAmB,EAAeA,EAAM,EAAI,EAC9C,EACC,MAAM,oBAAoB,CAC3B,IAAI,GAAK,EAAE,aAAa,CAAC,EAAI,EAAE,CAQpC,OAPI,EAAM,SAAW,EACZ,GAEL,EAAM,SAAW,EACZ,EAAM,GAGR,EAAM,QAAQ,EAAa,IACzB,GAAG,EAAI,GAAG,EAAK,aAAa,GAAG,aAAa,CACnD"}
|
package/dist/prepositions.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e
|
|
1
|
+
const e=`about.above.across.after.against.along.among.around.at.because of.before.behind.below.beneath.beside.besides.between.beyond.but.by.concerning.despite.down.during.except.excepting.for.from.in.in front of.inside.in spite of.instead of.into.like.near.of.off.on.onto.out.outside.over.past.regarding.since.through.throughout.to.toward.under.underneath.until.up.upon.up to.with.within.without.with regard to.with respect to`.split(`.`);exports.PREPOSITIONS=e;
|
package/dist/prepositions.d.cts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepositions.d.cts","names":[],"sources":["../src/prepositions.ts"],"sourcesContent":[],"mappings":";cAkBa"}
|
package/dist/prepositions.d.mts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepositions.d.mts","names":[],"sources":["../src/prepositions.ts"],"sourcesContent":[],"mappings":";cAkBa"}
|
package/dist/prepositions.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
const e=`about.above.across.after.against.along.among.around.at.because of.before.behind.below.beneath.beside.besides.between.beyond.but.by.concerning.despite.down.during.except.excepting.for.from.in.in front of.inside.in spite of.instead of.into.like.near.of.off.on.onto.out.outside.over.past.regarding.since.through.throughout.to.toward.under.underneath.until.up.upon.up to.with.within.without.with regard to.with respect to`.split(`.`);export{e as PREPOSITIONS};
|
|
2
|
+
//# sourceMappingURL=prepositions.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prepositions.mjs","names":[],"sources":["../src/prepositions.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const PREPOSITIONS = [\n \"about\",\n \"above\",\n \"across\",\n \"after\",\n \"against\",\n \"along\",\n \"among\",\n \"around\",\n \"at\",\n \"because of\",\n \"before\",\n \"behind\",\n \"below\",\n \"beneath\",\n \"beside\",\n \"besides\",\n \"between\",\n \"beyond\",\n \"but\",\n \"by\",\n \"concerning\",\n \"despite\",\n \"down\",\n \"during\",\n \"except\",\n \"excepting\",\n \"for\",\n \"from\",\n \"in\",\n \"in front of\",\n \"inside\",\n \"in spite of\",\n \"instead of\",\n \"into\",\n \"like\",\n \"near\",\n \"of\",\n \"off\",\n \"on\",\n \"onto\",\n \"out\",\n \"outside\",\n \"over\",\n \"past\",\n \"regarding\",\n \"since\",\n \"through\",\n \"throughout\",\n \"to\",\n \"toward\",\n \"under\",\n \"underneath\",\n \"until\",\n \"up\",\n \"upon\",\n \"up to\",\n \"with\",\n \"within\",\n \"without\",\n \"with regard to\",\n \"with respect to\"\n];\n"],"mappings":"AAkBA,MAAa,EAAe,8aA8D3B"}
|
package/dist/pretty-bytes.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=
|
|
1
|
+
const e=[`B`,`kB`,`MB`,`GB`,`TB`,`PB`,`EB`,`ZB`,`YB`],t=[`B`,`KiB`,`MiB`,`GiB`,`TiB`,`PiB`,`EiB`,`ZiB`,`YiB`],n=[`b`,`kbit`,`Mbit`,`Gbit`,`Tbit`,`Pbit`,`Ebit`,`Zbit`,`Ybit`],r=[`b`,`kibit`,`Mibit`,`Gibit`,`Tibit`,`Pibit`,`Eibit`,`Zibit`,`Yibit`],i=(e,t,n={})=>{let r=e,i=t;return typeof i==`string`?(i||=process.env.STORM_LOCALE||`en-US`,Array.isArray(i)&&(r=e?.toLocaleString(i,n))):(i===!0||n!==void 0)&&(r=e?.toLocaleString(void 0,n)),String(r)};function a(a,o){let s=a;if(!Number.isFinite(s))throw TypeError(`Expected a finite number, got ${typeof s}: ${s}`);let c={bits:!1,binary:!1,space:!0,...o},l=c.bits?c.binary?r:n:c.binary?t:e,u=c.space?` `:``;if(c.signed&&s===0)return` 0${u}${l[0]}`;let d=s<0,f=d?`-`:c.signed?`+`:``;d&&(s=-s);let p;if(c.minimumFractionDigits!==void 0&&(p={minimumFractionDigits:c.minimumFractionDigits}),c.maximumFractionDigits!==void 0&&(p={maximumFractionDigits:c.maximumFractionDigits,...p}),s<1)return f+i(s,c.locale,p)+u+l[0];let m=Math.min(Math.floor(c.binary?Math.log(s)/Math.log(1024):Math.log10(s)/3),l.length-1);s/=(c.binary?1024:1e3)**m,p||(s=s.toPrecision(3));let h=i(Number(s),c.locale,p),g=l[m];return f+h+u+g}exports.prettyBytes=a,exports.toLocaleString=i;
|
package/dist/pretty-bytes.d.cts
CHANGED
|
@@ -1,2 +1,152 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/pretty-bytes.d.ts
|
|
2
|
+
interface Options {
|
|
3
|
+
/**
|
|
4
|
+
* Include plus sign for positive numbers. If the difference is exactly zero a space character will be prepended instead for better alignment.
|
|
5
|
+
*
|
|
6
|
+
* @defaultValue false
|
|
7
|
+
*/
|
|
8
|
+
readonly signed?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* - If `false`: Output won't be localized.
|
|
11
|
+
* - If `true`: Localize the output using the system/browser locale.
|
|
12
|
+
* - If `string`: Expects a [BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) (For example: `en`, `de`, …)
|
|
13
|
+
* - If `string[]`: Expects a list of [BCP 47 language tags](https://en.wikipedia.org/wiki/IETF_language_tag) (For example: `en`, `de`, …)
|
|
14
|
+
*
|
|
15
|
+
* @defaultValue false
|
|
16
|
+
*/
|
|
17
|
+
readonly locale?: boolean | string | readonly string[];
|
|
18
|
+
/**
|
|
19
|
+
* Format the number as [bits](https://en.wikipedia.org/wiki/Bit) instead of [bytes](https://en.wikipedia.org/wiki/Byte). This can be useful when, for example, referring to [bit rate](https://en.wikipedia.org/wiki/Bit_rate).
|
|
20
|
+
*
|
|
21
|
+
* @defaultValue false
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { prettyBytes } from '@stryke/string-fns/pretty-bytes';
|
|
26
|
+
*
|
|
27
|
+
* prettyBytes(1337, {bits: true});
|
|
28
|
+
* //=> '1.34 kbit'
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
readonly bits?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Format the number using the [Binary Prefix](https://en.wikipedia.org/wiki/Binary_prefix) instead of the [SI Prefix](https://en.wikipedia.org/wiki/SI_prefix). This can be useful for presenting memory amounts. However, this should not be used for presenting file sizes.
|
|
34
|
+
*
|
|
35
|
+
* @defaultValue false
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { prettyBytes } from '@stryke/string-fns/pretty-bytes';
|
|
40
|
+
*
|
|
41
|
+
* prettyBytes(1000, {binary: true});
|
|
42
|
+
* //=> '1000 bit'
|
|
43
|
+
*
|
|
44
|
+
* prettyBytes(1024, {binary: true});
|
|
45
|
+
* //=> '1 kiB'
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
readonly binary?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* The minimum number of fraction digits to display.
|
|
51
|
+
*
|
|
52
|
+
* If neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.
|
|
53
|
+
*
|
|
54
|
+
* @defaultValue undefined
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { prettyBytes } from '@stryke/string-fns/pretty-bytes';
|
|
59
|
+
*
|
|
60
|
+
* // Show the number with at least 3 fractional digits
|
|
61
|
+
* prettyBytes(1900, {minimumFractionDigits: 3});
|
|
62
|
+
* //=> '1.900 kB'
|
|
63
|
+
*
|
|
64
|
+
* prettyBytes(1900);
|
|
65
|
+
* //=> '1.9 kB'
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
readonly minimumFractionDigits?: number;
|
|
69
|
+
/**
|
|
70
|
+
* The maximum number of fraction digits to display.
|
|
71
|
+
*
|
|
72
|
+
* If neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.
|
|
73
|
+
*
|
|
74
|
+
* @defaultValue undefined
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* import { prettyBytes } from '@stryke/string-fns/pretty-bytes';
|
|
79
|
+
*
|
|
80
|
+
* // Show the number with at most 1 fractional digit
|
|
81
|
+
* prettyBytes(1920, {maximumFractionDigits: 1});
|
|
82
|
+
* //=> '1.9 kB'
|
|
83
|
+
*
|
|
84
|
+
* prettyBytes(1920);
|
|
85
|
+
* //=> '1.92 kB'
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
readonly maximumFractionDigits?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Put a space between the number and unit.
|
|
91
|
+
*
|
|
92
|
+
* @defaultValue true
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* import { prettyBytes } from '@stryke/string-fns/pretty-bytes';
|
|
97
|
+
*
|
|
98
|
+
* prettyBytes(1920, {space: false});
|
|
99
|
+
* //=> '1.9kB'
|
|
100
|
+
*
|
|
101
|
+
* prettyBytes(1920);
|
|
102
|
+
* //=> '1.92 kB'
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
readonly space?: boolean;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Formats the given number using `Number#toLocaleString`.
|
|
109
|
+
*
|
|
110
|
+
* @remarks
|
|
111
|
+
* - If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
112
|
+
* - If locale is true, the system default locale is used for translation.
|
|
113
|
+
* - If no value for locale is specified, the number is returned unmodified.
|
|
114
|
+
*
|
|
115
|
+
* @param number - The number to format.
|
|
116
|
+
* @param locale - The locale to use for formatting the number.
|
|
117
|
+
* @param options - The options to use for formatting the number.
|
|
118
|
+
* @returns The formatted number.
|
|
119
|
+
*/
|
|
120
|
+
declare const toLocaleString: (number?: number | string, locale?: string | readonly string[] | boolean, options?: Options) => string;
|
|
121
|
+
/**
|
|
122
|
+
* Convert bytes to a human readable string: `1337` → `1.34 kB`.
|
|
123
|
+
*
|
|
124
|
+
* @param number - The number to format.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* import { prettyBytes } from '@stryke/string-fns/pretty-bytes';
|
|
129
|
+
*
|
|
130
|
+
* prettyBytes(1337);
|
|
131
|
+
* //=> '1.34 kB'
|
|
132
|
+
*
|
|
133
|
+
* prettyBytes(100);
|
|
134
|
+
* //=> '100 B'
|
|
135
|
+
*
|
|
136
|
+
* // Display file size differences
|
|
137
|
+
* prettyBytes(42, {signed: true});
|
|
138
|
+
* //=> '+42 B'
|
|
139
|
+
*
|
|
140
|
+
* // Localized output using German locale
|
|
141
|
+
* prettyBytes(1337, {locale: 'de'});
|
|
142
|
+
* //=> '1,34 kB'
|
|
143
|
+
* ```
|
|
144
|
+
*
|
|
145
|
+
* @param number - The number to format.
|
|
146
|
+
* @param options - The options to use.
|
|
147
|
+
* @returns The formatted string.
|
|
148
|
+
*/
|
|
149
|
+
declare function prettyBytes(number: number, options?: Options): string;
|
|
150
|
+
//#endregion
|
|
151
|
+
export { Options, prettyBytes, toLocaleString };
|
|
152
|
+
//# sourceMappingURL=pretty-bytes.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pretty-bytes.d.cts","names":[],"sources":["../src/pretty-bytes.ts"],"sourcesContent":[],"mappings":";UAkBiB,OAAA;EAAA;AAgKjB;AAiDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAjDa,oGAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8CK,WAAA,2BAAsC"}
|
package/dist/pretty-bytes.d.mts
CHANGED
|
@@ -1,2 +1,152 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/pretty-bytes.d.ts
|
|
2
|
+
interface Options {
|
|
3
|
+
/**
|
|
4
|
+
* Include plus sign for positive numbers. If the difference is exactly zero a space character will be prepended instead for better alignment.
|
|
5
|
+
*
|
|
6
|
+
* @defaultValue false
|
|
7
|
+
*/
|
|
8
|
+
readonly signed?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* - If `false`: Output won't be localized.
|
|
11
|
+
* - If `true`: Localize the output using the system/browser locale.
|
|
12
|
+
* - If `string`: Expects a [BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) (For example: `en`, `de`, …)
|
|
13
|
+
* - If `string[]`: Expects a list of [BCP 47 language tags](https://en.wikipedia.org/wiki/IETF_language_tag) (For example: `en`, `de`, …)
|
|
14
|
+
*
|
|
15
|
+
* @defaultValue false
|
|
16
|
+
*/
|
|
17
|
+
readonly locale?: boolean | string | readonly string[];
|
|
18
|
+
/**
|
|
19
|
+
* Format the number as [bits](https://en.wikipedia.org/wiki/Bit) instead of [bytes](https://en.wikipedia.org/wiki/Byte). This can be useful when, for example, referring to [bit rate](https://en.wikipedia.org/wiki/Bit_rate).
|
|
20
|
+
*
|
|
21
|
+
* @defaultValue false
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { prettyBytes } from '@stryke/string-fns/pretty-bytes';
|
|
26
|
+
*
|
|
27
|
+
* prettyBytes(1337, {bits: true});
|
|
28
|
+
* //=> '1.34 kbit'
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
readonly bits?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Format the number using the [Binary Prefix](https://en.wikipedia.org/wiki/Binary_prefix) instead of the [SI Prefix](https://en.wikipedia.org/wiki/SI_prefix). This can be useful for presenting memory amounts. However, this should not be used for presenting file sizes.
|
|
34
|
+
*
|
|
35
|
+
* @defaultValue false
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { prettyBytes } from '@stryke/string-fns/pretty-bytes';
|
|
40
|
+
*
|
|
41
|
+
* prettyBytes(1000, {binary: true});
|
|
42
|
+
* //=> '1000 bit'
|
|
43
|
+
*
|
|
44
|
+
* prettyBytes(1024, {binary: true});
|
|
45
|
+
* //=> '1 kiB'
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
readonly binary?: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* The minimum number of fraction digits to display.
|
|
51
|
+
*
|
|
52
|
+
* If neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.
|
|
53
|
+
*
|
|
54
|
+
* @defaultValue undefined
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { prettyBytes } from '@stryke/string-fns/pretty-bytes';
|
|
59
|
+
*
|
|
60
|
+
* // Show the number with at least 3 fractional digits
|
|
61
|
+
* prettyBytes(1900, {minimumFractionDigits: 3});
|
|
62
|
+
* //=> '1.900 kB'
|
|
63
|
+
*
|
|
64
|
+
* prettyBytes(1900);
|
|
65
|
+
* //=> '1.9 kB'
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
readonly minimumFractionDigits?: number;
|
|
69
|
+
/**
|
|
70
|
+
* The maximum number of fraction digits to display.
|
|
71
|
+
*
|
|
72
|
+
* If neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.
|
|
73
|
+
*
|
|
74
|
+
* @defaultValue undefined
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
78
|
+
* import { prettyBytes } from '@stryke/string-fns/pretty-bytes';
|
|
79
|
+
*
|
|
80
|
+
* // Show the number with at most 1 fractional digit
|
|
81
|
+
* prettyBytes(1920, {maximumFractionDigits: 1});
|
|
82
|
+
* //=> '1.9 kB'
|
|
83
|
+
*
|
|
84
|
+
* prettyBytes(1920);
|
|
85
|
+
* //=> '1.92 kB'
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
readonly maximumFractionDigits?: number;
|
|
89
|
+
/**
|
|
90
|
+
* Put a space between the number and unit.
|
|
91
|
+
*
|
|
92
|
+
* @defaultValue true
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* import { prettyBytes } from '@stryke/string-fns/pretty-bytes';
|
|
97
|
+
*
|
|
98
|
+
* prettyBytes(1920, {space: false});
|
|
99
|
+
* //=> '1.9kB'
|
|
100
|
+
*
|
|
101
|
+
* prettyBytes(1920);
|
|
102
|
+
* //=> '1.92 kB'
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
readonly space?: boolean;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Formats the given number using `Number#toLocaleString`.
|
|
109
|
+
*
|
|
110
|
+
* @remarks
|
|
111
|
+
* - If locale is a string, the value is expected to be a locale-key (for example: `de`).
|
|
112
|
+
* - If locale is true, the system default locale is used for translation.
|
|
113
|
+
* - If no value for locale is specified, the number is returned unmodified.
|
|
114
|
+
*
|
|
115
|
+
* @param number - The number to format.
|
|
116
|
+
* @param locale - The locale to use for formatting the number.
|
|
117
|
+
* @param options - The options to use for formatting the number.
|
|
118
|
+
* @returns The formatted number.
|
|
119
|
+
*/
|
|
120
|
+
declare const toLocaleString: (number?: number | string, locale?: string | readonly string[] | boolean, options?: Options) => string;
|
|
121
|
+
/**
|
|
122
|
+
* Convert bytes to a human readable string: `1337` → `1.34 kB`.
|
|
123
|
+
*
|
|
124
|
+
* @param number - The number to format.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* import { prettyBytes } from '@stryke/string-fns/pretty-bytes';
|
|
129
|
+
*
|
|
130
|
+
* prettyBytes(1337);
|
|
131
|
+
* //=> '1.34 kB'
|
|
132
|
+
*
|
|
133
|
+
* prettyBytes(100);
|
|
134
|
+
* //=> '100 B'
|
|
135
|
+
*
|
|
136
|
+
* // Display file size differences
|
|
137
|
+
* prettyBytes(42, {signed: true});
|
|
138
|
+
* //=> '+42 B'
|
|
139
|
+
*
|
|
140
|
+
* // Localized output using German locale
|
|
141
|
+
* prettyBytes(1337, {locale: 'de'});
|
|
142
|
+
* //=> '1,34 kB'
|
|
143
|
+
* ```
|
|
144
|
+
*
|
|
145
|
+
* @param number - The number to format.
|
|
146
|
+
* @param options - The options to use.
|
|
147
|
+
* @returns The formatted string.
|
|
148
|
+
*/
|
|
149
|
+
declare function prettyBytes(number: number, options?: Options): string;
|
|
150
|
+
//#endregion
|
|
151
|
+
export { Options, prettyBytes, toLocaleString };
|
|
152
|
+
//# sourceMappingURL=pretty-bytes.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pretty-bytes.d.mts","names":[],"sources":["../src/pretty-bytes.ts"],"sourcesContent":[],"mappings":";UAkBiB,OAAA;EAAA;AAgKjB;AAiDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAjDa,oGAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8CK,WAAA,2BAAsC"}
|
package/dist/pretty-bytes.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
const e=[`B`,`kB`,`MB`,`GB`,`TB`,`PB`,`EB`,`ZB`,`YB`],t=[`B`,`KiB`,`MiB`,`GiB`,`TiB`,`PiB`,`EiB`,`ZiB`,`YiB`],n=[`b`,`kbit`,`Mbit`,`Gbit`,`Tbit`,`Pbit`,`Ebit`,`Zbit`,`Ybit`],r=[`b`,`kibit`,`Mibit`,`Gibit`,`Tibit`,`Pibit`,`Eibit`,`Zibit`,`Yibit`],i=(e,t,n={})=>{let r=e,i=t;return typeof i==`string`?(i||=process.env.STORM_LOCALE||`en-US`,Array.isArray(i)&&(r=e?.toLocaleString(i,n))):(i===!0||n!==void 0)&&(r=e?.toLocaleString(void 0,n)),String(r)};function a(a,o){let s=a;if(!Number.isFinite(s))throw TypeError(`Expected a finite number, got ${typeof s}: ${s}`);let c={bits:!1,binary:!1,space:!0,...o},l=c.bits?c.binary?r:n:c.binary?t:e,u=c.space?` `:``;if(c.signed&&s===0)return` 0${u}${l[0]}`;let d=s<0,f=d?`-`:c.signed?`+`:``;d&&(s=-s);let p;if(c.minimumFractionDigits!==void 0&&(p={minimumFractionDigits:c.minimumFractionDigits}),c.maximumFractionDigits!==void 0&&(p={maximumFractionDigits:c.maximumFractionDigits,...p}),s<1)return f+i(s,c.locale,p)+u+l[0];let m=Math.min(Math.floor(c.binary?Math.log(s)/Math.log(1024):Math.log10(s)/3),l.length-1);s/=(c.binary?1024:1e3)**m,p||(s=s.toPrecision(3));let h=i(Number(s),c.locale,p),g=l[m];return f+h+u+g}export{a as prettyBytes,i as toLocaleString};
|
|
2
|
+
//# sourceMappingURL=pretty-bytes.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pretty-bytes.mjs","names":["_number: string | number"],"sources":["../src/pretty-bytes.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport interface Options {\n /**\n * Include plus sign for positive numbers. If the difference is exactly zero a space character will be prepended instead for better alignment.\n *\n * @defaultValue false\n */\n readonly signed?: boolean;\n\n /**\n * - If `false`: Output won't be localized.\n * - If `true`: Localize the output using the system/browser locale.\n * - If `string`: Expects a [BCP 47 language tag](https://en.wikipedia.org/wiki/IETF_language_tag) (For example: `en`, `de`, …)\n * - If `string[]`: Expects a list of [BCP 47 language tags](https://en.wikipedia.org/wiki/IETF_language_tag) (For example: `en`, `de`, …)\n *\n * @defaultValue false\n */\n readonly locale?: boolean | string | readonly string[];\n\n /**\n * Format the number as [bits](https://en.wikipedia.org/wiki/Bit) instead of [bytes](https://en.wikipedia.org/wiki/Byte). This can be useful when, for example, referring to [bit rate](https://en.wikipedia.org/wiki/Bit_rate).\n *\n * @defaultValue false\n *\n * @example\n * ```ts\n * import { prettyBytes } from '@stryke/string-fns/pretty-bytes';\n *\n * prettyBytes(1337, {bits: true});\n * //=> '1.34 kbit'\n * ```\n */\n readonly bits?: boolean;\n\n /**\n * Format the number using the [Binary Prefix](https://en.wikipedia.org/wiki/Binary_prefix) instead of the [SI Prefix](https://en.wikipedia.org/wiki/SI_prefix). This can be useful for presenting memory amounts. However, this should not be used for presenting file sizes.\n *\n * @defaultValue false\n *\n * @example\n * ```ts\n * import { prettyBytes } from '@stryke/string-fns/pretty-bytes';\n *\n * prettyBytes(1000, {binary: true});\n * //=> '1000 bit'\n *\n * prettyBytes(1024, {binary: true});\n * //=> '1 kiB'\n * ```\n */\n readonly binary?: boolean;\n\n /**\n * The minimum number of fraction digits to display.\n *\n * If neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.\n *\n * @defaultValue undefined\n *\n * @example\n * ```ts\n * import { prettyBytes } from '@stryke/string-fns/pretty-bytes';\n *\n * // Show the number with at least 3 fractional digits\n * prettyBytes(1900, {minimumFractionDigits: 3});\n * //=> '1.900 kB'\n *\n * prettyBytes(1900);\n * //=> '1.9 kB'\n * ```\n */\n readonly minimumFractionDigits?: number;\n\n /**\n * The maximum number of fraction digits to display.\n *\n * If neither `minimumFractionDigits` or `maximumFractionDigits` are set, the default behavior is to round to 3 significant digits.\n *\n * @defaultValue undefined\n *\n * @example\n * ```ts\n * import { prettyBytes } from '@stryke/string-fns/pretty-bytes';\n *\n * // Show the number with at most 1 fractional digit\n * prettyBytes(1920, {maximumFractionDigits: 1});\n * //=> '1.9 kB'\n *\n * prettyBytes(1920);\n * //=> '1.92 kB'\n * ```\n */\n readonly maximumFractionDigits?: number;\n\n /**\n * Put a space between the number and unit.\n *\n * @defaultValue true\n *\n * @example\n * ```ts\n * import { prettyBytes } from '@stryke/string-fns/pretty-bytes';\n *\n * prettyBytes(1920, {space: false});\n * //=> '1.9kB'\n *\n * prettyBytes(1920);\n * //=> '1.92 kB'\n * ```\n */\n readonly space?: boolean;\n}\n\nconst BYTE_UNITS = [\"B\", \"kB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"];\nconst BIBYTE_UNITS = [\n \"B\",\n \"KiB\",\n \"MiB\",\n \"GiB\",\n \"TiB\",\n \"PiB\",\n \"EiB\",\n \"ZiB\",\n \"YiB\"\n];\nconst BIT_UNITS = [\n \"b\",\n \"kbit\",\n \"Mbit\",\n \"Gbit\",\n \"Tbit\",\n \"Pbit\",\n \"Ebit\",\n \"Zbit\",\n \"Ybit\"\n];\nconst BIBIT_UNITS = [\n \"b\",\n \"kibit\",\n \"Mibit\",\n \"Gibit\",\n \"Tibit\",\n \"Pibit\",\n \"Eibit\",\n \"Zibit\",\n \"Yibit\"\n];\n\n/**\n * Formats the given number using `Number#toLocaleString`.\n *\n * @remarks\n * - If locale is a string, the value is expected to be a locale-key (for example: `de`).\n * - If locale is true, the system default locale is used for translation.\n * - If no value for locale is specified, the number is returned unmodified.\n *\n * @param number - The number to format.\n * @param locale - The locale to use for formatting the number.\n * @param options - The options to use for formatting the number.\n * @returns The formatted number.\n */\nexport const toLocaleString = (\n number?: number | string,\n locale?: string | readonly string[] | boolean,\n options: Options = {}\n): string => {\n let result = number;\n let _locale = locale;\n if (typeof _locale === \"string\") {\n if (!_locale) {\n _locale = process.env.STORM_LOCALE || \"en-US\";\n }\n if (Array.isArray(_locale)) {\n result = number?.toLocaleString(_locale, options);\n }\n } else if (_locale === true || options !== undefined) {\n result = number?.toLocaleString(undefined, options);\n }\n\n return String(result);\n};\n\n/**\n * Convert bytes to a human readable string: `1337` → `1.34 kB`.\n *\n * @param number - The number to format.\n *\n * @example\n * ```ts\n * import { prettyBytes } from '@stryke/string-fns/pretty-bytes';\n *\n * prettyBytes(1337);\n * //=> '1.34 kB'\n *\n * prettyBytes(100);\n * //=> '100 B'\n *\n * // Display file size differences\n * prettyBytes(42, {signed: true});\n * //=> '+42 B'\n *\n * // Localized output using German locale\n * prettyBytes(1337, {locale: 'de'});\n * //=> '1,34 kB'\n * ```\n *\n * @param number - The number to format.\n * @param options - The options to use.\n * @returns The formatted string.\n */\nexport function prettyBytes(number: number, options?: Options): string {\n let _number: string | number = number;\n if (!Number.isFinite(_number)) {\n throw new TypeError(\n `Expected a finite number, got ${typeof _number}: ${_number}`\n );\n }\n\n const opts = {\n bits: false,\n binary: false,\n space: true,\n ...options\n };\n\n const UNITS = opts.bits\n ? opts.binary\n ? BIBIT_UNITS\n : BIT_UNITS\n : opts.binary\n ? BIBYTE_UNITS\n : BYTE_UNITS;\n\n const separator = opts.space ? \" \" : \"\";\n\n if (opts.signed && _number === 0) {\n return ` 0${separator}${UNITS[0]}`;\n }\n\n const isNegative = _number < 0;\n\n const prefix = isNegative ? \"-\" : opts.signed ? \"+\" : \"\";\n\n if (isNegative) {\n _number = -_number;\n }\n\n let localeOptions;\n\n if (opts.minimumFractionDigits !== undefined) {\n localeOptions = { minimumFractionDigits: opts.minimumFractionDigits };\n }\n\n if (opts.maximumFractionDigits !== undefined) {\n localeOptions = {\n maximumFractionDigits: opts.maximumFractionDigits,\n ...localeOptions\n };\n }\n\n if (_number < 1) {\n const numberString = toLocaleString(_number, opts.locale, localeOptions);\n\n return prefix + numberString + separator + UNITS[0];\n }\n\n const exponent = Math.min(\n Math.floor(\n opts.binary ? Math.log(_number) / Math.log(1024) : Math.log10(_number) / 3\n ),\n UNITS.length - 1\n );\n _number /= (opts.binary ? 1024 : 1000) ** exponent;\n\n if (!localeOptions) {\n _number = _number.toPrecision(3);\n }\n\n const numberString = toLocaleString(\n Number(_number),\n opts.locale,\n localeOptions\n );\n\n const unit = UNITS[exponent];\n\n return prefix + numberString + separator + unit;\n}\n"],"mappings":"AAkIA,MAAM,EAAa,CAAC,IAAK,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAM,KAAK,CAClE,EAAe,CACnB,IACA,MACA,MACA,MACA,MACA,MACA,MACA,MACA,MACD,CACK,EAAY,CAChB,IACA,OACA,OACA,OACA,OACA,OACA,OACA,OACA,OACD,CACK,EAAc,CAClB,IACA,QACA,QACA,QACA,QACA,QACA,QACA,QACA,QACD,CAeY,GACX,EACA,EACA,EAAmB,EAAE,GACV,CACX,IAAI,EAAS,EACT,EAAU,EAYd,OAXI,OAAO,GAAY,UACrB,AACE,IAAU,QAAQ,IAAI,cAAgB,QAEpC,MAAM,QAAQ,EAAQ,GACxB,EAAS,GAAQ,eAAe,EAAS,EAAQ,IAE1C,IAAY,IAAQ,IAAY,IAAA,MACzC,EAAS,GAAQ,eAAe,IAAA,GAAW,EAAQ,EAG9C,OAAO,EAAO,EA+BvB,SAAgB,EAAY,EAAgB,EAA2B,CACrE,IAAIA,EAA2B,EAC/B,GAAI,CAAC,OAAO,SAAS,EAAQ,CAC3B,MAAU,UACR,iCAAiC,OAAO,EAAQ,IAAI,IACrD,CAGH,IAAM,EAAO,CACX,KAAM,GACN,OAAQ,GACR,MAAO,GACP,GAAG,EACJ,CAEK,EAAQ,EAAK,KACf,EAAK,OACH,EACA,EACF,EAAK,OACH,EACA,EAEA,EAAY,EAAK,MAAQ,IAAM,GAErC,GAAI,EAAK,QAAU,IAAY,EAC7B,MAAO,KAAK,IAAY,EAAM,KAGhC,IAAM,EAAa,EAAU,EAEvB,EAAS,EAAa,IAAM,EAAK,OAAS,IAAM,GAElD,IACF,EAAU,CAAC,GAGb,IAAI,EAaJ,GAXI,EAAK,wBAA0B,IAAA,KACjC,EAAgB,CAAE,sBAAuB,EAAK,sBAAuB,EAGnE,EAAK,wBAA0B,IAAA,KACjC,EAAgB,CACd,sBAAuB,EAAK,sBAC5B,GAAG,EACJ,EAGC,EAAU,EAGZ,OAAO,EAFc,EAAe,EAAS,EAAK,OAAQ,EAAc,CAEzC,EAAY,EAAM,GAGnD,IAAM,EAAW,KAAK,IACpB,KAAK,MACH,EAAK,OAAS,KAAK,IAAI,EAAQ,CAAG,KAAK,IAAI,KAAK,CAAG,KAAK,MAAM,EAAQ,CAAG,EAC1E,CACD,EAAM,OAAS,EAChB,CACD,IAAY,EAAK,OAAS,KAAO,MAAS,EAErC,IACH,EAAU,EAAQ,YAAY,EAAE,EAGlC,IAAM,EAAe,EACnB,OAAO,EAAQ,CACf,EAAK,OACL,EACD,CAEK,EAAO,EAAM,GAEnB,OAAO,EAAS,EAAe,EAAY"}
|
package/dist/snake-case.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./
|
|
1
|
+
const e=require(`./types/src/base.cjs`),t=require(`./upper-case-first.cjs`),n=require(`./constant-case.cjs`);function r(e){return e?/^[a-z]+(?:_[a-z0-9]+)*$/.test(e):!1}function i(i,a){if(r(i)||i===void 0)return i;if(n.isConstantCase(i))return i.toLowerCase();let o=i?.replace(/[A-Z]+/g,n=>t.upperCaseFirst(n)??e.EMPTY_STRING).split(/(?=[A-Z])|[\s._-]/).map(e=>e.toLowerCase())??[];if(o.length===0)return``;if(o.length===1)return o[0];let s=o.reduce((e,t)=>`${e}_${t.toLowerCase()}`);return a?.splitOnNumber===!1?s:s.replace(/[A-Z]\d/i,e=>`${e[0]}_${e[1]}`)}exports.isSnakeCase=r,exports.snakeCase=i;
|
package/dist/snake-case.d.cts
CHANGED
|
@@ -1,2 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/snake-case.d.ts
|
|
2
|
+
interface SnakeCaseOptions {
|
|
3
|
+
splitOnNumber: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Check if the input string is in snake case.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Snake case is defined as all lowercase letters with underscores separating words - "this_is_an_example"
|
|
10
|
+
*
|
|
11
|
+
* @param input - The input string to check.
|
|
12
|
+
* @returns True if the input is in snake case, false otherwise.
|
|
13
|
+
*/
|
|
14
|
+
declare function isSnakeCase(input: string | undefined): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Convert the input string to snake case.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Snake case is defined as all lowercase letters with underscores separating words - "this_is_an_example"
|
|
20
|
+
*
|
|
21
|
+
* @param input - The input string.
|
|
22
|
+
* @param options - Options to control the behavior of the function.
|
|
23
|
+
* @returns The snake-cased string.
|
|
24
|
+
*/
|
|
25
|
+
declare function snakeCase<T extends string | undefined>(input: T, options?: SnakeCaseOptions): T;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { SnakeCaseOptions, isSnakeCase, snakeCase };
|
|
28
|
+
//# sourceMappingURL=snake-case.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snake-case.d.cts","names":[],"sources":["../src/snake-case.ts"],"sourcesContent":[],"mappings":";UAsBiB,gBAAA;EAAA,aAAA,EAAA,OAAgB;AAajC;AAcA;;;;;;;;;iBAdgB,WAAA;;;;;;;;;;;iBAcA,+CACP,aACG,mBACT"}
|
package/dist/snake-case.d.mts
CHANGED
|
@@ -1,2 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
//#region src/snake-case.d.ts
|
|
2
|
+
interface SnakeCaseOptions {
|
|
3
|
+
splitOnNumber: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Check if the input string is in snake case.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* Snake case is defined as all lowercase letters with underscores separating words - "this_is_an_example"
|
|
10
|
+
*
|
|
11
|
+
* @param input - The input string to check.
|
|
12
|
+
* @returns True if the input is in snake case, false otherwise.
|
|
13
|
+
*/
|
|
14
|
+
declare function isSnakeCase(input: string | undefined): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Convert the input string to snake case.
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Snake case is defined as all lowercase letters with underscores separating words - "this_is_an_example"
|
|
20
|
+
*
|
|
21
|
+
* @param input - The input string.
|
|
22
|
+
* @param options - Options to control the behavior of the function.
|
|
23
|
+
* @returns The snake-cased string.
|
|
24
|
+
*/
|
|
25
|
+
declare function snakeCase<T extends string | undefined>(input: T, options?: SnakeCaseOptions): T;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { SnakeCaseOptions, isSnakeCase, snakeCase };
|
|
28
|
+
//# sourceMappingURL=snake-case.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snake-case.d.mts","names":[],"sources":["../src/snake-case.ts"],"sourcesContent":[],"mappings":";UAsBiB,gBAAA;EAAA,aAAA,EAAA,OAAgB;AAajC;AAcA;;;;;;;;;iBAdgB,WAAA;;;;;;;;;;;iBAcA,+CACP,aACG,mBACT"}
|
package/dist/snake-case.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{EMPTY_STRING as e}from"./types/src/base.mjs";import{upperCaseFirst as t}from"./upper-case-first.mjs";import{isConstantCase as n}from"./constant-case.mjs";function r(e){return e?/^[a-z]+(?:_[a-z0-9]+)*$/.test(e):!1}function i(i,a){if(r(i)||i===void 0)return i;if(n(i))return i.toLowerCase();let o=i?.replace(/[A-Z]+/g,n=>t(n)??e).split(/(?=[A-Z])|[\s._-]/).map(e=>e.toLowerCase())??[];if(o.length===0)return``;if(o.length===1)return o[0];let s=o.reduce((e,t)=>`${e}_${t.toLowerCase()}`);return a?.splitOnNumber===!1?s:s.replace(/[A-Z]\d/i,e=>`${e[0]}_${e[1]}`)}export{r as isSnakeCase,i as snakeCase};
|
|
2
|
+
//# sourceMappingURL=snake-case.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snake-case.mjs","names":["input"],"sources":["../src/snake-case.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { EMPTY_STRING } from \"@stryke/types\";\nimport { isConstantCase } from \"./constant-case\";\nimport { upperCaseFirst } from \"./upper-case-first\";\n\nexport interface SnakeCaseOptions {\n splitOnNumber: boolean;\n}\n\n/**\n * Check if the input string is in snake case.\n *\n * @remarks\n * Snake case is defined as all lowercase letters with underscores separating words - \"this_is_an_example\"\n *\n * @param input - The input string to check.\n * @returns True if the input is in snake case, false otherwise.\n */\nexport function isSnakeCase(input: string | undefined): boolean {\n return input ? /^[a-z]+(?:_[a-z0-9]+)*$/.test(input) : false;\n}\n\n/**\n * Convert the input string to snake case.\n *\n * @remarks\n * Snake case is defined as all lowercase letters with underscores separating words - \"this_is_an_example\"\n *\n * @param input - The input string.\n * @param options - Options to control the behavior of the function.\n * @returns The snake-cased string.\n */\nexport function snakeCase<T extends string | undefined>(\n input: T,\n options?: SnakeCaseOptions\n): T {\n if (isSnakeCase(input) || input === undefined) {\n return input;\n }\n\n if (isConstantCase(input)) {\n return input.toLowerCase() as T;\n }\n\n const parts =\n input\n ?.replace(\n /[A-Z]+/g,\n (input?: string) => upperCaseFirst(input) ?? EMPTY_STRING\n )\n .split(/(?=[A-Z])|[\\s._-]/)\n .map((x: string) => x.toLowerCase()) ?? [];\n if (parts.length === 0) {\n return \"\" as T;\n }\n if (parts.length === 1) {\n return parts[0] as T;\n }\n const result = parts.reduce((ret: string, part: string) => {\n return `${ret}_${part.toLowerCase()}`;\n });\n\n return (\n options?.splitOnNumber === false\n ? result\n : result.replace(/[A-Z]\\d/i, (val: string) => `${val[0]}_${val[1]}`)\n ) as T;\n}\n"],"mappings":"iKAmCA,SAAgB,EAAY,EAAoC,CAC9D,OAAO,EAAQ,0BAA0B,KAAK,EAAM,CAAG,GAazD,SAAgB,EACd,EACA,EACG,CACH,GAAI,EAAY,EAAM,EAAI,IAAU,IAAA,GAClC,OAAO,EAGT,GAAI,EAAe,EAAM,CACvB,OAAO,EAAM,aAAa,CAG5B,IAAM,EACJ,GACI,QACA,UACC,GAAmB,EAAeA,EAAM,EAAI,EAC9C,CACA,MAAM,oBAAoB,CAC1B,IAAK,GAAc,EAAE,aAAa,CAAC,EAAI,EAAE,CAC9C,GAAI,EAAM,SAAW,EACnB,MAAO,GAET,GAAI,EAAM,SAAW,EACnB,OAAO,EAAM,GAEf,IAAM,EAAS,EAAM,QAAQ,EAAa,IACjC,GAAG,EAAI,GAAG,EAAK,aAAa,GACnC,CAEF,OACE,GAAS,gBAAkB,GACvB,EACA,EAAO,QAAQ,WAAa,GAAgB,GAAG,EAAI,GAAG,GAAG,EAAI,KAAK"}
|
package/dist/special-cases.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e
|
|
1
|
+
const e=`2FA.4K.5K.8K.AGI.BI.ChatGPT.CTA.DateTime.FMS.GitHub.GPT.HD.IBMid.IDs.iMac.IMAX.iOS.iPad.iPhone.iPod.LDAP.LinkedIn.LLM.macOS.McDonalds.MCP.ML.MySQL.NLG.NLP.NLU.OpenAI.PDFs.PIM.PEFT.pH.PostgreSQL.SEO.TTS.UHD.UUID.XSS.YouTube.CSpell.ESLint`.split(`.`);exports.SPECIAL_CASES=e;
|
package/dist/special-cases.d.cts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"special-cases.d.cts","names":[],"sources":["../src/special-cases.ts"],"sourcesContent":[],"mappings":";cAkBa"}
|
package/dist/special-cases.d.mts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"special-cases.d.mts","names":[],"sources":["../src/special-cases.ts"],"sourcesContent":[],"mappings":";cAkBa"}
|
package/dist/special-cases.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
const e=`2FA.4K.5K.8K.AGI.BI.ChatGPT.CTA.DateTime.FMS.GitHub.GPT.HD.IBMid.IDs.iMac.IMAX.iOS.iPad.iPhone.iPod.LDAP.LinkedIn.LLM.macOS.McDonalds.MCP.ML.MySQL.NLG.NLP.NLU.OpenAI.PDFs.PIM.PEFT.pH.PostgreSQL.SEO.TTS.UHD.UUID.XSS.YouTube.CSpell.ESLint`.split(`.`);export{e as SPECIAL_CASES};
|
|
2
|
+
//# sourceMappingURL=special-cases.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"special-cases.mjs","names":[],"sources":["../src/special-cases.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nexport const SPECIAL_CASES = [\n \"2FA\",\n \"4K\",\n \"5K\",\n \"8K\",\n \"AGI\",\n \"BI\",\n \"ChatGPT\",\n \"CTA\",\n \"DateTime\",\n \"FMS\",\n \"GitHub\",\n \"GPT\",\n \"HD\",\n \"IBMid\",\n \"IDs\",\n \"iMac\",\n \"IMAX\",\n \"iOS\",\n \"iPad\",\n \"iPhone\",\n \"iPod\",\n \"LDAP\",\n \"LinkedIn\",\n \"LLM\",\n \"macOS\",\n \"McDonalds\",\n \"MCP\",\n \"ML\",\n \"MySQL\",\n \"NLG\",\n \"NLP\",\n \"NLU\",\n \"OpenAI\",\n \"PDFs\",\n \"PIM\",\n \"PEFT\",\n \"pH\",\n \"PostgreSQL\",\n \"SEO\",\n \"TTS\",\n \"UHD\",\n \"UUID\",\n \"XSS\",\n \"YouTube\",\n \"CSpell\",\n \"ESLint\"\n];\n"],"mappings":"AAkBA,MAAa,EAAgB,yPA+C5B"}
|
package/dist/start-case.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require(`./
|
|
1
|
+
const e=require(`./get-words.cjs`);function t(e){return e?/^[A-Z][a-z]*(?: [A-Z][a-z]*)*$/.test(e):!1}function n(n){if(t(n)||n===void 0)return n;let r=e.getWords(n.trim()),i=``;for(let e of r)e&&e[0]&&(i&&(i+=` `),i+=e===e.toUpperCase()?e:e[0].toUpperCase()+e.slice(1).toLowerCase());return i}exports.isStartCase=t,exports.startCase=n;
|