Created
May 9, 2018 21:01
-
-
Save virgenherrera/11cb90b5ae54a35b7bce44b463df26c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ObjectId() { | |
| const timestamp = (new Date().getTime() / 1000 | 0).toString(16); | |
| const randomize = () => Math.random() * 16 | 0; | |
| const randStr = 'xxxxxxxxxxxxxxxx'.replace(/x/g, () => randomize().toString(16)).toLowerCase(); | |
| return `${timestamp}${randStr}`; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment