ustring

String utility functions

MIT 11 个版本
安装
npm install ustring
yarn add ustring
pnpm add ustring
bun add ustring
README

String utility methods

Installation

npm install ustring

API

var ustring = require('ustring')

toLowerFirst

ustring.toLowerFirst('ABC') == 'aBC'

toUpperFirstFirst

ustring.toUpperFirst('abc') == 'Abc'

hyphenate

ustring.hyphenate('ThisIsMyWord') == 'this-is-my-word'

humanize

ustring.humanize('This_is-a-very-long-sentence') == 'This is a very long sentence'

camelize

ustring.camelize('This-is-a-very-long-word') == 'ThisIsAVeryLongWord'

endsWith

ustring.endsWith('hello world','world') == true
ustring.endsWith('hello world','wor') == false
ustring.endsWith(123, 3) == true

is.alphanum

ustring.is.alphanum('abcd09') == true
ustring.is.alphanum('abcd09#%#$') == false

is.match

ustring.is.match(/^[a-zA-Z0-9]+$/, 'abcd09') == true
ustring.is.match(/^[a-zA-Z0-9]+$/, 'abcd09#%#$') == false

Since match is a curried fn, you can even write

var matches = ustring.is.match(/^[a-zA-Z0-9]+$/)
matches('abc')

Tests

make

License

MIT

版本列表
1.4.1 2014-09-26
1.4.0 2014-09-22
1.3.2 2014-09-02
1.3.1 2014-09-02
1.3.0 2014-08-21
1.2.1 2014-08-18
1.2.0 2014-08-18
1.1.1 2014-08-05
1.1.0 2014-07-22
1.0.1 2014-07-22
1.0.0 2014-07-22