Initial commit
This commit is contained in:
commit
ec49fedc45
1288 files changed
+226749
No files matched your search
+20
@@ -0,0 +1,20 @@
|
||||
module.exports = function(length) {
|
||||
var last = null
|
||||
, repeat = 0
|
||||
|
||||
if (typeof length == 'undefined') length = 15
|
||||
|
||||
return function() {
|
||||
var now = Math.pow(10, 2) * +new Date()
|
||||
|
||||
if (now == last) {
|
||||
repeat++
|
||||
} else {
|
||||
repeat = 0
|
||||
last = now
|
||||
}
|
||||
|
||||
var s = (now + repeat).toString()
|
||||
return +s.substr(s.length - length)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user