2.2.0 • Published 6 years ago

commons-utils v2.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

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);
2.2.0

6 years ago

2.1.0

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.10.0

7 years ago

1.9.0

7 years ago

1.8.0

7 years ago

1.7.0

7 years ago

1.6.0

7 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago