Skip to content

Commit

Permalink
Merge pull request #11236 from Uzlopak/replace-ms-with-lukeed
Browse files Browse the repository at this point in the history
Replace ms with faster @lukeed/ms
  • Loading branch information
vkarpov15 authored Jan 20, 2022
2 parents d6898a7 + 6b6f6be commit 433af2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
12 changes: 4 additions & 8 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Module dependencies.
*/

const ms = require('ms');
const ms = require('@lukeed/ms');
const mpath = require('mpath');
const sliced = require('sliced');
const Decimal = require('./types/decimal128');
Expand Down Expand Up @@ -502,13 +502,9 @@ exports.expires = function expires(object) {
return;
}

let when;
if (typeof object.expires !== 'string') {
when = object.expires;
} else {
when = Math.round(ms(object.expires) / 1000);
}
object.expireAfterSeconds = when;
object.expireAfterSeconds = (typeof object.expires !== 'string')
? object.expires
: Math.round(ms.parse(object.expires) / 1000);
delete object.expires;
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@
],
"license": "MIT",
"dependencies": {
"@lukeed/ms": "^2.0.0",
"@types/node": "< 17.0.6",
"bson": "^4.2.2",
"kareem": "2.3.3",
"mongodb": "4.3.0",
"mpath": "0.8.4",
"mquery": "4.0.0",
"ms": "2.1.2",
"regexp-clone": "1.0.0",
"sift": "13.5.2",
"sliced": "1.0.1"
Expand Down

0 comments on commit 433af2b

Please sign in to comment.