@karmaniverous/string-utilities
v0.2.2
Published
Handy tagged templates & other string utilities.
Readme
string-utilities
Handy tagged templates & other string utilities.
To install:
npm i @karmaniverous/string-utilitiesContents:
Types
Stringifiable- Represents any value with atoStringmethod.isStringifiable- Returnstruewhen value hastoStringmethod.
Transformations
normstr- Normalize a string by converting diacriticals to base characters, removing non-word characters, and converting to lower case. Non-strings return undefined.
Tagged Template Functions
Non-stringifiable to Empty String (
n2e) - Replaces expressions withouttoStringproperty with empty strings.Some Non-stringifiable to Empty String (
sn2e) - Returns empty string when any expression has notoStringproperty.Some Non-stringifiable to Null (
sn2n) - Returnsnullwhen any expression has notoStringproperty.Some Non-stringifiable to Undefined (
sn2u) - Returnsundefinedwhen any expression has notoStringproperty.
Higher-Order Functions
Non-stringifiable to Default (
n2d) - Returns tagged template function that replaces any expression that has notoStringproperty with a default value.Some Non-stringifiable to Default (
sn2d) - Returns tagged template function that returns a default value when any expression has notoStringproperty.
Built for you with ❤️ on Bali! Find more great tools & templates on my GitHub Profile.
