cu

commons-utils

Common Utilities Package for JavaScript. Most of implementation are written in ES6. Common Utils are Arrays: Shuffling, diff, flatten. String: isObject, ObjectType, isXXX type, Case: CamelCase, pascalCase, titlecase, toggleCase, swapCase, dotCase, kebabCase, snakeCase and random utilities

Showing:

Popularity

Downloads/wk

18

GitHub Stars

1

Maintenance

Last Commit

5mos ago

Contributors

1

Package

Dependencies

0

Size (min+gzip)

6.0KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Commons Utilities

Common Available Methods

clone;
remove;
shuffle;
sample;
uniq;
compact;
reverse;
union;
intersection;
diff;
flatten;
last;
findIndices;

camelCase;
pascalCase;
titleCase;
toggleCase;
swapCase;
dotCase;
random;
guid;
formatCurrency;
isEmpty;
isInteger;
isNumber;
isJsonString;
isString;
removeHtmlTags;
extractURLs;
extractPhones;
extractEmails;
extractPercent;
extractNumbers;
extractUSCurrencyAndNumbers;
extractHyphenated;
extractTime;
extractDotted;
extractQuoted;
replaceAt;
removeAt;
size;

removeObject;
safeparse;

isValidEmail;
isValidUrl;
isValidImage;
isValidUSA_SSN;
isValidDate;
isValidCreditCard;
isValidCitizenId;

Countries that are supported

Brazil i.e. "BR"
Croatia "HR"
Ireland i.e. "IE"
San Marino ie "SM"
Thailand i.e. "TH"
Turkey i.e. "TR":

How to use it

Install

npm install -S commons-utils

Code Sample

const CommonsUtils = require('commons-utils');

CommonsUtils.dotCase('userName'); //user.name
CommonsUtils.dotCase("user   Name"); // user.name
CommonsUtils.pascalCase("user name"); // userName
CommonsUtils.camelCase("user name"); // userName
CommonsUtils.titleCase("user name"); // User Name
CommonsUtils.toggleCase("user name"); // USER NAME

CommonsUtils.random.alphabetical(5); // qemhI
CommonsUtils.random.alphanumeric(5); // 8Czd5
CommonsUtils.random.numerical(5); // 91125
CommonsUtils.random.default(10,100); // 62
CommonsUtils.random.color("Pujan"); // hsl(210,60%, 70%)
CommonsUtils.random.color(); // #1a157b

Queue Implementations

const q = new Queue();
q.add(1);
q.add(2);
q.add(3);
      

const q = new LimitedQueue(5);

const lruCache = new lruCache(5);

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100