Timo Hocker 9275a9c82e update-scanner: automatic update
@scode/eslint-config: 2.0.10 ==> 2.0.11 minor
ava: 3.7.0 ==> 3.7.1 minor
2020-04-21 11:28:17 +02:00
fix
2020-03-30 14:09:23 +02:00
2020-04-18 17:01:17 +02:00
2020-03-25 17:01:22 +01:00
2020-03-14 14:12:44 +01:00
2020-03-04 12:13:28 +01:00
2020-04-17 07:52:57 +02:00
2020-03-30 11:21:05 +02:00
2020-03-25 17:01:22 +01:00
2020-03-04 12:13:28 +01:00
2020-04-14 14:58:27 +02:00
2020-03-30 11:00:52 +02:00
2020-03-25 17:01:22 +01:00
2020-04-21 11:28:17 +02:00

Utilities

General helper functions

const util = require('@scode/utilities');

// cut off decimal places to a specified point
util.truncate_decimal(12.345678, 2);
// returns 12.34

// will return null instead of throwing on invalid json
util.try_parse_json('{{foo');

// copy an object to prevent modification of the original
const obj = {foo:'bar'};
const copy = util.copy_object(obj);
copy.foo = 'baz';
console.log(obj.foo); // bar

// run a regular expression and get a callback for every result
const data = "foobarfoo";
const regex = /foo/g;
util.run_regex(regex, data, res => {
  console.log(res[0]); // will output 'foo' 2 times
});
Description
No description provided
Readme 357 KiB
Languages
JavaScript 100%