0.1.16 • Published 12 days ago

bridge-mix v0.1.16

Weekly downloads
-
License
ISC
Repository
-
Last release
12 days ago

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

0.1.16

12 days ago

0.1.15

17 days ago

0.1.13

24 days ago

0.1.14

24 days ago

0.1.11

30 days ago

0.1.12

30 days ago

0.1.10

2 months ago

0.1.8

2 months ago

0.1.9

2 months ago

0.1.7

2 months ago

0.1.6

2 months ago

0.1.5

2 months ago

0.1.4

2 months ago

0.1.3

2 months ago

0.1.0

3 months ago

0.1.2

3 months ago

0.0.60

5 months ago

0.0.59

5 months ago

0.0.40

8 months ago

0.0.41

8 months ago

0.0.42

7 months ago

0.0.43

7 months ago

0.0.44

7 months ago

0.0.45

6 months ago

0.0.46

6 months ago

0.0.47

6 months ago

0.0.37

9 months ago

0.0.38

8 months ago

0.0.39

8 months ago

0.0.30

10 months ago

0.0.31

10 months ago

0.0.32

9 months ago

0.0.33

9 months ago

0.0.34

9 months ago

0.0.35

9 months ago

0.0.36

9 months ago

0.0.51

6 months ago

0.0.52

6 months ago

0.0.54

6 months ago

0.0.55

6 months ago

0.0.56

6 months ago

0.0.57

6 months ago

0.0.58

6 months ago

0.0.50

6 months ago

0.0.48

6 months ago

0.0.49

6 months ago

0.0.28

10 months ago

0.0.29

10 months ago

0.0.25

12 months ago

0.0.26

12 months ago

0.0.27

11 months ago

0.0.20

1 year ago

0.0.21

12 months ago

0.0.22

12 months ago

0.0.23

12 months ago

0.0.24

12 months ago

0.0.18

1 year ago

0.0.19

1 year ago

0.0.16

1 year ago

0.0.10

1 year ago

0.0.12

1 year ago

0.0.13

1 year ago

0.0.14

1 year ago

0.0.15

1 year ago

0.0.9

1 year ago

0.0.7

1 year ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago