Skip to content

Commit f2acf88

Browse files
committed
Add returns to CLI
1 parent f53b8f2 commit f2acf88

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ hashkey-middleware
66
CLI Usage
77
---------
88

9-
node index.js [number]
9+
node index.js [number|hashkey]
1010

1111
Hashkey
1212
---------

index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ function hashKeyMiddlewareWrapper (options = {
3232

3333
if (options.isMainModule === true) {
3434
const hashid = genHashId(idHashids, process.argv[2]);
35+
let decoded = decHashId(idHashids, process.argv[2]);
36+
decoded = { id: decoded[0], time: new Date(decoded[1]) };
3537
return {
3638
hashid,
37-
decoded: decHashId(idHashids, hashid),
39+
decoded: decoded || decHashId(idHashids, hashid),
3840
};
3941
}
4042

0 commit comments

Comments
 (0)