fixed stop yelling error for unset local emojis
This commit is contained in:
parent
d7e1ca5e29
commit
99eadc8f58
1 changed files with 5 additions and 2 deletions
7
index.js
7
index.js
|
@ -23,9 +23,9 @@ if (options.enable !== false) {
|
|||
// load custom emojis
|
||||
var localEmojis = options.localEmojis
|
||||
// JSON string
|
||||
if (!_.isObject(localEmojis)) {
|
||||
if (_.isString(localEmojis)) {
|
||||
try {
|
||||
localEmojis = JSON.parse(localEmojis.toString())
|
||||
localEmojis = JSON.parse(localEmojis)
|
||||
Object.keys(localEmojis).forEach(function (name) {
|
||||
if (_.isString(localEmojis[name])) {
|
||||
localEmojis[name] = {
|
||||
|
@ -38,6 +38,9 @@ if (options.enable !== false) {
|
|||
console.warn('filter-github-emojis: local emojis error')
|
||||
}
|
||||
}
|
||||
if (!_.isObject(localEmojis)) {
|
||||
localEmojis = {}
|
||||
}
|
||||
Object.keys(localEmojis).forEach(function (name) {
|
||||
var codepoints = localEmojis[name].codepoints
|
||||
if (codepoints && !_.isArray(codepoints)) {
|
||||
|
|
Loading…
Reference in a new issue