@6thbridge/utils v0.3.8
bridge-utils
bridge-utils - This is a utility package for reused component
Installation
"dependencies": {
"@6thbridge/utils": "^0.2.34" // see the "releases" section
}npm install @6thbridge/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); //2348012345678Phone 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=1Tests
Cli
npm install
npm testContributors
11 months ago
11 months ago
12 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago
6 months ago
6 months ago
6 months ago
6 months ago
1 year ago
1 year ago
6 months ago
1 year ago
1 year ago
7 months ago
7 months ago
8 months ago
6 months ago
6 months ago
6 months ago
7 months ago
7 months ago
7 months ago
7 months ago
11 months ago
8 months ago
7 months ago
8 months ago
8 months ago
7 months ago
8 months ago
8 months ago
7 months ago
11 months ago
7 months ago
11 months ago
7 months ago
7 months ago
8 months ago
8 months ago
8 months ago
8 months ago
11 months ago
11 months ago
8 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
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago