2.0.0 - 2022-12-28
words
: keeps words consisting of alpha-numeric characters. Previously, also symbols like comma or exclamation mark were kept as words
- bump dependencies
- provide named export
Str
used viaimport { Str } from '@supercharge/strings'
const { Str } = require('@supercharge/strings')
- drop support for Node.js v12 and require Node.js v14
- we’re using this package only with Node.js and not in browser environments and this change may also have effects in the browser that we can’t determine at this point
1.29.1 - 2022-11-18
lcFirst
: won’t fail for empty stringsucFirst
: won’t fail for empty strings
1.29.0 - 2022-10-20
equals(string | Str)
: you can now pass aStr
instance for comparisonsnotEquals(string | Str)
: you can now pass aStr
instance for comparisonsisLowerLetters()
: determine whether the wrapped string is lowercase and consists of letters only
- bump deps
1.28.0 - 2022-05-30
hasLength(length)
: determine whether the string has the givenlength
isAlphaNumeric(input)
: determine whether the giveninput
is an alpha-numeric string
1.27.1 - 2022-05-06
- bring back Node.js v12 support
1.27.0 - 2022-04-25
random
: add support for a random string builder- example:
Str.random(use => use.length(10).numbers().characters())
results in a random string using only numbers and characters with a length of 10
- example:
1.26.0 - 2022-04-11
squish()
: remove all extra whitespaces and also trim the string (remove leading and trailing whitespaces)
1.25.1 - 2022-04-06
- bump deps
- properly handle boolean
false
values as strings- before:
false
was replaced with an empty string - now:
false
will be wrapped properly to a string'false'
- before:
1.25.0 - 2022-01-24
stripHtml()
: remove HTML tags from the string
- bump deps
replace(searchValue: string | RegEx)
: add theRegEx
type annotation to the search value in the replace method
1.24.0 - 2021-11-17
padBoth(length, pad)
: pad both sides, left and right, of the string with the givenpad
string (repeatedly if needed) so that the resulting string reaches a givenlength
equalsIgnoreCase(value)
: determine whether the string equals givenvalue
when ignoring character casing
- use UVU and c8 for testing and coverage report
1.23.1 - 2021-11-12
- updated the
splitCamel()
method to trim each word
1.23.0 - 2021-11-12
lines()
: breaks the string at the newline character and returns an array of linesisCamel()
: determine whether the given string is written in camelCasewords()
: returns the list of words for the given string
1.22.0 - 2021-10-13
at(position)
: returns the character at the givenposition
isSymbol()
: determine whether the string is a JavaScriptSymbol
isUuid()
: determine whether the string is a UUID
1.21.0 - 2021-09-08
containsBom()
: determine whether the string contains a byte order mark (BOM) at any positionstartsWithBom()
: determine whether the string starts with the byte order mark (BOM)
- bump dependencies
- refined types for
Str.isString(value)
allowing TypeScript to properly resolve thestring
type
1.20.0 - 2021-09-03
stripExtraSpaces()
: removes all extra spaces from a string and leaves only a single space at the given positionshuffle()
: randomly shuffle the characters of the string (using the fisher yates shuffle algorithm)slice(start, end)
: returns a section of the string fromstart
toend
stripBom()
: removes the byte order mark (BOM) from the string
- bump dependencies
1.19.0 - 2021-07-29
chars()
: returns the list of characters for the given string
- bump dependencies
- remove not needed
eslint-plugin-standard
dependency: not needed when usingeslint-config-standard v16
1.18.0 - 2021-01-23
slug(separator = '-')
: convert the string to a URL-friendly “slug” in kebab-case
- bump dependencies
kebab(separator = '-')
: add theseparator
parameter to thekebab
method
1.17.1 - 2020-12-10
- fixed typings for
parseCallback)
method
1.17.0 - 2020-12-10
parseCallback(separator = '@', defaultValue?)
: parse a Class[@]method style string into the Class and method names
- bump dependencies
1.16.0 - 2020-11-18
notEquals(value)
: determine whether the string does not equal the givenvalue
notIncludes(needle)
: determine whether the string does not contain the givenneedle
includesAll(...needles)
: determine whether the string contains all of the givenneedles
- bump dependencies
1.15.1 - 2020-10-23
replaceLast(search, replacement)
now returns the original string if the searched value isn’t part of the string
1.15.0 - 2020-10-22
reverse()
: reverses the stringreplaceLast(search, replacement)
: replaces the last occurrence of the givensearch
string with thereplacement
- bump dependencies
contains(...needles)
: determine whether the given string contains any of the given needles. Before, you could only check for one needle (contains(needle)
)
1.14.0 - 2020-10-21
finish(suffix)
: ensures the string ends with the givensuffix
padLeft(length, pad)
: pads the string on the left side until the length is reachedpadRight(length, pad)
: pads the string on the right side until the length is reached
- bump dependencies
- allow array as an argument for
append
,prepend
, andcontainsAll
ltrim(char)
removes every occurrence ofchar
from the beginning of the string, not just the firstrtrim(char)
removes every occurrence ofchar
from the end of the string, not just the last
1.13.0 - 2020-10-20
afterLast(delimiter)
: returns the portion of the string after the last occurrence ofdelimiter
append(...values)
: appends the givenvalues
to the stringbeforeLast(delimiter)
: returns the portion of the string before the last occurrence ofdelimiter
prepend(...values)
: prepends the givenvalues
to the stringstart(prefix)
: ensures the string starts with the givenprefix
replace(search, value)
: replaces the first occurrence ofsearch
withvalue
in the string
- bump dependencies
1.12.0 - 2020-09-15
before(delimiter)
: returns the portion of the string before the first occurrence of the givendelimiter
after(delimiter)
: returns the portion of the string after the first occurrence of the givendelimiter
stripNums()
: removes all numbers from the string
- bump dependencies
- change
main
entrypoint inpackage.json
todist
folder - move test runner from
@hapi/lab
tojest
- move assertions from
@hapi/code
tojest
- remove
index.js
file which acted as a middleman to export fromdist
folder
1.11.0 - 2020-07-27
containsAll(needles)
: determine whether all items in theneedles
array are part of the string
- bump dependencies
1.10.0 - 2020-07-14
notContains(needle)
: determine whether the given string does not contain the givenneedle
- bump dependencies
1.9.0 - 2020-06-04
ltrim(characters)
,rtrim(characters)
andtrim(characters)
: support acharacters
parameter allowing you to trim a specific string value from the beginning, end, or both of a value:Str('/supercharge/').trim('/').get()
=>'supercharge'
Str('/supercharge/').ltrim('/').get()
=>'supercharge/'
Str('/supercharge/').rtrim('/').get()
=>'/supercharge'
1.8.0 - 2020-05-18
snake()
: converts a string to snake_casekebab()
: converts a string to kebab-casepascal()
: converts a string to PascalCase or also known as StudlyCase
- GitHub Action to publish this package in the GitHub Package Registry
1.7.0 - 2020-05-13
- type definitions
- bump dependencies
- move codebase to TypeScript to automatically generate type definitions
1.6.0 - 2020-05-12
.limit(limit, end)
: returns the firstlimit
characters and ends the limited string withend
1.5.0 - 2020-05-05
Str.isString(value)
: determine whether the givenvalue
is a string
1.4.0 - 2020-04-24
.ltrim()
: remove all whitespace from the left of the string.rtrim()
: remove all whitespace from the rigth of the string.concat()
: returns a string that contains the concatenation of two or more strings
1.3.0 - 2020-04-03
.split(separator)
: split the string into an ordered set of substrings where theseparator
occurs.equals(value)
: determine whether the string equals the givenvalue
.startsWith(needle, position)
: determine whether the string starts with theneedle
.endsWith(needle, length)
: determine whether the string ends with theneedle
1.2.0 - 2020-01-27
.ucFirst()
: uppercase the first character in the string.replaceAll()
: replace all occurences in a string
- bump deps
- Readme: fix scope in package name (from
@superchargejs
to@supercharge
)
1.1.0 - 2019-12-17
.isEmpty()
: determine whether the string value is empty (''/undefined/null
).isNotEmpty()
: determine whether the string value has a length of 1 or greater
1.0.1 - 2019-12-15
- GitHub Workflow publishing this package in the GitHub Package Registry
files
configuration inpackage.json
file to only publish package parts, not tests. This reduces the package size
1.0.0
release 🚀 🎉