mirror of
https://github.com/typicode/json-server.git
synced 2025-07-28 20:52:08 +08:00
Use shortid
This commit is contained in:
@ -20,11 +20,11 @@
|
|||||||
"lowdb": "^0.13.1",
|
"lowdb": "^0.13.1",
|
||||||
"method-override": "^2.1.2",
|
"method-override": "^2.1.2",
|
||||||
"morgan": "^1.3.1",
|
"morgan": "^1.3.1",
|
||||||
"node-uuid": "^1.4.2",
|
|
||||||
"object-assign": "^4.0.1",
|
"object-assign": "^4.0.1",
|
||||||
"pluralize": "^3.0.0",
|
"pluralize": "^3.0.0",
|
||||||
"request": "^2.72.0",
|
"request": "^2.72.0",
|
||||||
"server-destroy": "^1.0.1",
|
"server-destroy": "^1.0.1",
|
||||||
|
"shortid": "^2.2.6",
|
||||||
"underscore-db": "^0.12.0",
|
"underscore-db": "^0.12.0",
|
||||||
"update-notifier": "^1.0.2",
|
"update-notifier": "^1.0.2",
|
||||||
"yargs": "^4.2.0"
|
"yargs": "^4.2.0"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const uuid = require('node-uuid')
|
const shortid = require('shortid')
|
||||||
const pluralize = require('pluralize')
|
const pluralize = require('pluralize')
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
@ -46,7 +46,7 @@ function createId (coll) {
|
|||||||
// Increment integer id or generate string id
|
// Increment integer id or generate string id
|
||||||
return _.isFinite(id)
|
return _.isFinite(id)
|
||||||
? ++id
|
? ++id
|
||||||
: uuid()
|
: shortid.generate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user