bridge-mix v0.1.16
bridge-utils
bridge-utils - This is a utility package for reused component
Installation
"dependencies": {
"bridge-mix": "^0.1.16" // see the "releases" section
}
npm install tm-utils
Requirements
const utils = require('bridge-mix');
Phone Number Formatter (Single)
- To format a single phone number
let phoneNumber = "08012345678";
phoneNumber = utils.helpers.formatPhoneNumber(phoneNumber, "NG");
console.log(phoneNumber); //2348012345678
Phone Number Formatter (Multiple)
- To format an array of phone numbers
let phoneNumbers = ["08012345678", "08012345679"];
phoneNumbers = utils.helpers.formatPhoneNumberArray(phoneNumbers, "NG");
console.log(phoneNumbers); //['2348012345678','2348012345679']
Remove Empty Fields from Data
- To format an array of phone numbers
let data = {
"foo": "",
"bar": "value"
};
data = utils.helpers.removeFieldsWithEmptyValue(data);
console.log(data); //{"bar":"value"}
Logger
- Log data
logger.error("This is an error from the package", {foo: "bar"}, new Error().stack);
logger.warn("This is an warning message from the package", {foo: "bar"}, new Error().stack);
logger.debug("This is an debug message from the package", {foo: "bar"}, new Error().stack);
logger.critical("This is a critical message from the package", {foo: "bar"}, new Error().stack);
logger.info("This is a info message from the package", {foo: "bar"}, new Error().stack);
logger.exception(new Error("Custom Error"), {foo: "bar"}, new Error().stack);
logger.out(new Error("Custom Error"), {foo: "bar"}, new Error().stack); //to console, only logs out when LOG_OUT=1
Tests
Cli
npm install
npm test
Contributors
12 days ago
17 days ago
24 days ago
24 days ago
30 days ago
30 days ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
3 months ago
5 months ago
5 months ago
8 months ago
8 months ago
7 months ago
7 months ago
7 months ago
6 months ago
6 months ago
6 months ago
9 months ago
8 months ago
8 months ago
10 months ago
10 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
10 months ago
10 months ago
12 months ago
12 months ago
11 months ago
1 year ago
12 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago