refs #850 Replace is-empty to lodash
This commit is contained in:
parent
9036a7f780
commit
dd5eb4ad9d
|
@ -2009,6 +2009,15 @@
|
|||
"integrity": "sha512-pQvPkc4Nltyx7G1Ww45OjVqUsJP4UsZm+GWJpigXgkikZqJgRm4c48g027o6tdgubWHwFRF15iFd+Y4Pmqv6+Q==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/nedb": {
|
||||
"version": "1.8.7",
|
||||
"resolved": "https://registry.npmjs.org/@types/nedb/-/nedb-1.8.7.tgz",
|
||||
"integrity": "sha512-9YAo9VTD+AFj2/yar+T9+/u/t+pn9CtuXnIYcGADwbknWyymuIO4WXOY8boYYNO7bk4DIbDBpIMfHED3pUpkJA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@types/node": "11.11.4"
|
||||
}
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "11.11.4",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-11.11.4.tgz",
|
||||
|
|
|
@ -143,7 +143,6 @@
|
|||
"hoek": "^6.1.2",
|
||||
"i18next": "^12.1.0",
|
||||
"i18next-sync-fs-backend": "^1.1.0",
|
||||
"is-empty": "^1.2.0",
|
||||
"lodash": "^4.17.11",
|
||||
"megalodon": "0.6.3",
|
||||
"moment": "^2.21.0",
|
||||
|
@ -174,6 +173,7 @@
|
|||
"@types/i18next": "^12.1.0",
|
||||
"@types/jest": "^24.0.11",
|
||||
"@types/lodash": "^4.14.123",
|
||||
"@types/nedb": "^1.8.7",
|
||||
"@types/node": "^11.11.4",
|
||||
"@types/parse-link-header": "^1.0.0",
|
||||
"@typescript-eslint/eslint-plugin": "^1.5.0",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import empty from 'is-empty'
|
||||
import { isEmpty } from 'lodash'
|
||||
import Mastodon from 'megalodon'
|
||||
|
||||
export default class Account {
|
||||
|
@ -60,7 +60,7 @@ export default class Account {
|
|||
return new Promise((resolve, reject) => {
|
||||
this.db.insert(obj, (err, doc) => {
|
||||
if (err) return reject(err)
|
||||
if (empty(doc)) return reject(new EmptyRecordError('empty'))
|
||||
if (isEmpty(doc)) return reject(new EmptyRecordError('empty'))
|
||||
resolve(doc)
|
||||
})
|
||||
})
|
||||
|
@ -73,7 +73,7 @@ export default class Account {
|
|||
return new Promise((resolve, reject) => {
|
||||
this.db.find().sort({ order: order }).exec((err, docs) => {
|
||||
if (err) return reject(err)
|
||||
if (empty(docs)) return reject(new EmptyRecordError('empty'))
|
||||
if (isEmpty(docs)) return reject(new EmptyRecordError('empty'))
|
||||
resolve(docs)
|
||||
})
|
||||
})
|
||||
|
@ -86,7 +86,7 @@ export default class Account {
|
|||
return new Promise((resolve, reject) => {
|
||||
this.db.find({ accessToken: { $ne: '' } }).sort({ order: 1 }).exec((err, docs) => {
|
||||
if (err) return reject(err)
|
||||
if (empty(docs)) return reject(new EmptyRecordError('empty'))
|
||||
if (isEmpty(docs)) return reject(new EmptyRecordError('empty'))
|
||||
resolve(docs)
|
||||
})
|
||||
})
|
||||
|
@ -106,7 +106,7 @@ export default class Account {
|
|||
},
|
||||
(err, doc) => {
|
||||
if (err) return reject(err)
|
||||
if (empty(doc)) return reject(new EmptyRecordError('empty'))
|
||||
if (isEmpty(doc)) return reject(new EmptyRecordError('empty'))
|
||||
resolve(doc)
|
||||
}
|
||||
)
|
||||
|
@ -119,7 +119,7 @@ export default class Account {
|
|||
obj,
|
||||
(err, doc) => {
|
||||
if (err) return reject(err)
|
||||
if (empty(doc)) return reject(new EmptyRecordError('empty'))
|
||||
if (isEmpty(doc)) return reject(new EmptyRecordError('empty'))
|
||||
resolve(doc)
|
||||
})
|
||||
})
|
||||
|
@ -150,7 +150,7 @@ export default class Account {
|
|||
},
|
||||
(err, doc) => {
|
||||
if (err) return reject(err)
|
||||
if (empty(doc)) return reject(new EmptyRecordError('empty'))
|
||||
if (isEmpty(doc)) return reject(new EmptyRecordError('empty'))
|
||||
resolve(doc)
|
||||
})
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
import { app, ipcMain, shell, Menu, Tray, BrowserWindow, BrowserWindowConstructorOptions, MenuItemConstructorOptions } from 'electron'
|
||||
import Datastore from 'nedb'
|
||||
import empty from 'is-empty'
|
||||
import { isEmpty } from 'lodash'
|
||||
import log from 'electron-log'
|
||||
import windowStateKeeper from 'electron-window-state'
|
||||
import simplayer from 'simplayer'
|
||||
|
@ -282,9 +282,9 @@ ipcMain.on('get-access-token', (event, code) => {
|
|||
.then((token) => {
|
||||
accountDB.findOne({
|
||||
accessToken: token
|
||||
}, (err, doc) => {
|
||||
}, (err, doc: any) => {
|
||||
if (err) return event.sender.send('error-get-access-token', err)
|
||||
if (empty(doc)) return event.sender.send('error-get-access-token', 'error document is empty')
|
||||
if (isEmpty(doc)) return event.sender.send('error-get-access-token', 'error document is empty')
|
||||
event.sender.send('response-get-access-token', doc._id)
|
||||
})
|
||||
})
|
||||
|
@ -297,7 +297,7 @@ ipcMain.on('get-access-token', (event, code) => {
|
|||
// environments
|
||||
ipcMain.on('get-social-token', (event, _) => {
|
||||
const token = process.env.SOCIAL_TOKEN
|
||||
if (empty(token)) {
|
||||
if (isEmpty(token)) {
|
||||
return event.sender.send('error-get-social-token', new EmptyTokenError())
|
||||
}
|
||||
event.sender.send('response-get-social-token', token)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import empty from 'is-empty'
|
||||
import { isEmpty } from 'lodash'
|
||||
import Datastore from 'nedb'
|
||||
|
||||
export default class UnreadNotification {
|
||||
|
@ -48,7 +48,7 @@ export default class UnreadNotification {
|
|||
return new Promise((resolve, reject) => {
|
||||
this.db.findOne(obj, (err, doc) => {
|
||||
if (err) return reject(err)
|
||||
if (empty(doc)) return reject(new EmptyRecordError('empty'))
|
||||
if (isEmpty(doc)) return reject(new EmptyRecordError('empty'))
|
||||
resolve(doc)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue