mirror of
https://github.com/typicode/json-server.git
synced 2025-08-01 06:34:02 +08:00
Use deep equal
This commit is contained in:
@ -161,7 +161,7 @@ module.exports = function (argv) {
|
|||||||
if (is.JSON(file)) {
|
if (is.JSON(file)) {
|
||||||
var obj = JSON.parse(fs.readFileSync(file))
|
var obj = JSON.parse(fs.readFileSync(file))
|
||||||
// Compare .json file content with in memory database
|
// Compare .json file content with in memory database
|
||||||
var isDatabaseDifferent = !_.eq(obj, app.db.getState())
|
var isDatabaseDifferent = !_.isEqual(obj, app.db.getState())
|
||||||
if (isDatabaseDifferent) {
|
if (isDatabaseDifferent) {
|
||||||
console.log(chalk.gray(' ' + file + ' has changed, reloading...'))
|
console.log(chalk.gray(' ' + file + ' has changed, reloading...'))
|
||||||
server && server.destroy()
|
server && server.destroy()
|
||||||
|
Reference in New Issue
Block a user