Replace shortid to nanoid (#655)

This commit is contained in:
Andrey Sitnik
2017-10-11 00:49:50 +03:00
committed by typicode
parent 3707376b8a
commit 84d989294b
3 changed files with 8 additions and 8 deletions

10
package-lock.json generated
View File

@ -3345,6 +3345,11 @@
"integrity": "sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA=",
"dev": true
},
"nanoid": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-0.2.2.tgz",
"integrity": "sha512-GHoRrvNEKiwdkwQ/enKL8AhQkkrBC/2KxMZkDvQzp8OtkpX8ZAmoYJWFVl7l8F2+HcEJUfdg21Ab2wXXfrvACQ=="
},
"natural-compare": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
@ -4202,11 +4207,6 @@
"rechoir": "0.6.2"
}
},
"shortid": {
"version": "2.2.8",
"resolved": "https://registry.npmjs.org/shortid/-/shortid-2.2.8.tgz",
"integrity": "sha1-AzsRfWoul1gE9vCWnb59PQs1UTE="
},
"slash": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz",

View File

@ -22,12 +22,12 @@
"lowdb": "^0.15.0",
"method-override": "^2.1.2",
"morgan": "^1.3.1",
"nanoid": "^0.2.2",
"object-assign": "^4.0.1",
"please-upgrade-node": "^3.0.1",
"pluralize": "^3.0.0",
"request": "^2.72.0",
"server-destroy": "^1.0.1",
"shortid": "^2.2.6",
"update-notifier": "^1.0.2",
"yargs": "^6.0.0"
},

View File

@ -1,4 +1,4 @@
const shortid = require('shortid')
const nanoid = require('nanoid')
const pluralize = require('pluralize')
module.exports = {
@ -48,7 +48,7 @@ function createId(coll) {
let id = _(coll).maxBy(idProperty)[idProperty]
// Increment integer id or generate string id
return _.isFinite(id) ? ++id : shortid.generate()
return _.isFinite(id) ? ++id : nanoid(7)
}
}