Tag and build

This commit is contained in:
Angelos Chalaris
2017-12-16 14:32:16 +02:00
parent 89a78a72f6
commit 917aa5fcb6
2 changed files with 16 additions and 0 deletions

View File

@ -116,6 +116,7 @@
* [Is number](#is-number)
* [Is string](#is-string)
* [Is symbol](#is-symbol)
* [JSON to date](#json-to-date)
* [Measure time taken by function](#measure-time-taken-by-function)
* [Number to array of digits](#number-to-array-of-digits)
* [Ordinal suffix of number](#ordinal-suffix-of-number)
@ -1311,6 +1312,20 @@ const isSymbol = val => typeof val === 'symbol';
[⬆ back to top](#table-of-contents)
### JSON to date
Use `Date()`, to convert dates in JSON format to readable format (`dd/mm/yyyy`).
```js
const jsonToDate = arr => {
const dt = new Date(parseInt(arr.toString().substr(6)));
return `${ dt.getDate() }/${ dt.getMonth() + 1 }/${ dt.getFullYear() }`
};
// jsonToDate(/Date(1489525200000)/) -> "14/3/2017"
```
[⬆ back to top](#table-of-contents)
### Measure time taken by function
Use `console.time()` and `console.timeEnd()` to measure the difference between the start and end times to determine how long the callback took to execute.

View File

@ -55,6 +55,7 @@ is-function:utility
is-number:utility
is-string:utility
is-symbol:utility
JSON-to-date:utility
last-of-list:array
measure-time-taken-by-function:utility
median-of-array-of-numbers:array