2.6.6 • Published 2 years ago

@stool/core v2.6.6

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@stool/core

JavaScript core tools.

Install

npm install @stool/core

Using

String

camelCase()

camelCase('a-b-c'); // aBC

hyphenate()

hyphenate('aBC'); // a-b-c

format()

format('Hello {{name}}!!!', {name:'Tom'}); // 'Hello Tom!!!'

Function

noop()

declarate function noop() {};

tr()

Pick first value without error

tr(() => { throw new Error() }, () => 'One'); // 'One';

clone()

Clone object

Random

randomInt()

randomInt(10); // [0..9]
randomInt(5, 10); //[5..9]

choice()

choice(); // null
choice([1,2,3]); // 1 or 2 or 3

sid(len=32)

sid(); // IBA1CCRQ69NIELNLBG65WHHEGNVGQPO1 (32)
sid(3); //WK5

createUID()

const uid = createUID();
uid(); // '0'
...
uid(); // 'ac'
uid(); // 'ad'

License

MIT

2.6.6

2 years ago

2.6.5

2 years ago

2.6.4

2 years ago

2.6.1

5 years ago

2.7.0

6 years ago

2.6.0

6 years ago

2.5.0

6 years ago

2.4.0

6 years ago

2.3.0

6 years ago

2.2.0

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago