1.2.2 • Published 3 years ago

@sapphirecode/consts v1.2.2

Weekly downloads
13
License
MIT
Repository
-
Last release
3 years ago

@sapphirecode/consts

version: 1.2.x

useful constant values that are used in many applications

Installation

npm:

npm i --save @sapphirecode/consts

yarn:

yarn add @sapphirecode/consts

Usage

there are many constants, too many to document by hand so I suggest you use autocomplete or look into the source.

Http status codes:

const {http} = require('@sapphirecode/consts');

console.log(http.status_ok); // 200

Time

const {time} = require('@sapphirecode/consts');

console.log(time.base_ms.minute); // 60000

The time module contains a few precalculated bases like base_s, base_ms, base_us and base_ns. Those allow you to use timers without calculating everything first.

timer(base_ms.week) instead of timer(1000 x 60 x 60 x 24 x 7) or timer(base_us.week) if your timer counts in microseconds

time intervals above one week are functions, because they require additional information to be calculated

console.log(time.base_ms.year(2020));
console.log(time.base_ms.year(12, 2020));

License

MIT © Timo Hocker timo@scode.ovh

1.2.2

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.28

4 years ago

1.1.27

4 years ago

1.1.26

4 years ago

1.1.25

4 years ago

1.1.24

4 years ago

1.1.23

4 years ago

1.1.22

4 years ago

1.1.21

4 years ago

1.1.20

4 years ago

1.1.19

4 years ago

1.1.18

4 years ago

1.1.17

4 years ago

1.1.16

4 years ago

1.1.15

4 years ago

1.1.14

4 years ago

1.1.13

4 years ago

1.1.12

4 years ago