Remove Node.js v8 support (#1402)
This commit is contained in:
committed by
GitHub
parent
7801b2cc13
commit
ab5d8997b8
@ -27,8 +27,9 @@ const { SerializationError, DeserializationError } = require('./errors')
|
||||
class Serializer {
|
||||
serialize (object) {
|
||||
debug('Serializing', object)
|
||||
let json
|
||||
try {
|
||||
var json = JSON.stringify(object)
|
||||
json = JSON.stringify(object)
|
||||
} catch (err) {
|
||||
throw new SerializationError(err.message, object)
|
||||
}
|
||||
@ -37,8 +38,9 @@ class Serializer {
|
||||
|
||||
deserialize (json) {
|
||||
debug('Deserializing', json)
|
||||
let object
|
||||
try {
|
||||
var object = sjson.parse(json)
|
||||
object = sjson.parse(json)
|
||||
} catch (err) {
|
||||
throw new DeserializationError(err.message, json)
|
||||
}
|
||||
@ -50,8 +52,8 @@ class Serializer {
|
||||
if (Array.isArray(array) === false) {
|
||||
throw new SerializationError('The argument provided is not an array')
|
||||
}
|
||||
var ndjson = ''
|
||||
for (var i = 0, len = array.length; i < len; i++) {
|
||||
let ndjson = ''
|
||||
for (let i = 0, len = array.length; i < len; i++) {
|
||||
if (typeof array[i] === 'string') {
|
||||
ndjson += array[i] + '\n'
|
||||
} else {
|
||||
@ -67,8 +69,8 @@ class Serializer {
|
||||
if (typeof object === 'string') return object
|
||||
// arrays should be serialized as comma separated list
|
||||
const keys = Object.keys(object)
|
||||
for (var i = 0, len = keys.length; i < len; i++) {
|
||||
var key = keys[i]
|
||||
for (let i = 0, len = keys.length; i < len; i++) {
|
||||
const key = keys[i]
|
||||
// elasticsearch will complain for keys without a value
|
||||
if (object[key] === undefined) {
|
||||
delete object[key]
|
||||
|
||||
Reference in New Issue
Block a user