fix: remove _JSON

nolan/no-underscore-json
Nolan Lawson 2019-12-21 09:59:03 -08:00
parent 208099c2dc
commit 3a4dc78185
2 changed files with 3 additions and 7 deletions

View File

@ -2,8 +2,6 @@ import { buildSearch } from './data'
import stringFromCodePoint from '../polyfills/stringFromCodePoint'
import { uncompress } from './data'
const _JSON = JSON
const COLONS_REGEX = /^(?:\:([^\:]+)\:)(?:\:skin-tone-(\d)\:)?$/
const SKINS = ['1F3FA', '1F3FB', '1F3FC', '1F3FD', '1F3FE', '1F3FF']
@ -107,7 +105,7 @@ function getData(emoji, skin, set, data) {
emojiData.variations || (emojiData.variations = [])
if (emojiData.skin_variations && skin > 1) {
emojiData = JSON.parse(_JSON.stringify(emojiData))
emojiData = JSON.parse(JSON.stringify(emojiData))
var skinKey = SKINS[skin - 1],
variationData = emojiData.skin_variations[skinKey]
@ -132,7 +130,7 @@ function getData(emoji, skin, set, data) {
}
if (emojiData.variations && emojiData.variations.length) {
emojiData = JSON.parse(_JSON.stringify(emojiData))
emojiData = JSON.parse(JSON.stringify(emojiData))
emojiData.unified = emojiData.variations.shift()
}

View File

@ -1,7 +1,5 @@
var NAMESPACE = 'emoji-mart'
const _JSON = JSON
var isLocalStorageSupported =
typeof window !== 'undefined' && 'localStorage' in window
@ -32,7 +30,7 @@ function set(key, value) {
} else {
if (!isLocalStorageSupported) return
try {
window.localStorage[`${NAMESPACE}.${key}`] = _JSON.stringify(value)
window.localStorage[`${NAMESPACE}.${key}`] = JSON.stringify(value)
} catch (e) {}
}
}