Skip to content

Commit

Permalink
Adding new function
Browse files Browse the repository at this point in the history
  • Loading branch information
bolenge committed Jun 21, 2020
1 parent 9c183d6 commit ba61802
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,15 @@ const helpers = require('self-helpers');

console.log(helpers.objectEmpty({})); // true
console.log(helpers.objectEmpty({name: 'Sekikande'})); // false
```

#### convertDateToSeconds(date)

Converti une date en seconds

* `date` : La date à convertir

Exemple
```js
console.log(helpers.convertDateToSeconds(new Date()));
```
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,13 @@ exports.rand = (min, max, integer = true) => {
exports.objectEmpty = (object) => {

return Object.keys(object).length <= 0;
}

/**
* Converti une date en seconds
* @param {String} date La date à convertir
* @returns {Number} seconds
*/
exports.convertDateToSeconds = (date) => {
return new Date(date) / 1000 | 0;
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "self-helpers",
"version": "0.0.2",
"version": "0.0.3",
"description": "Package Javascript contenant un bon nombre des fonctions ou des logiques de code que nous utilisons régulièrement qui sont mis en fonctions",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit ba61802

Please sign in to comment.