'use strict'

/**
 * Copyright 2016-present, Dustin Deus (deusdustin@gmail.com)
 * All rights reserved.
 *
 * This source code is licensed under the MIT-style license found in the
 * LICENSE file in the root directory of this source tree.
 *
 */

const SafeStringify = require('fast-safe-stringify')

class Encoder {
  static encode(msg) {
    try {
      return {
        value: SafeStringify(msg)
      }
    } catch (error) {
      return {
        error
      }
    }
  }
}

module.exports = Encoder

@@ -294,16 +294,120 @@
 gify')%0A%0A
+/**%0A * Why do coerce to a Number?%0A * https://github.com/davidmarkclements/flatstr#how-does-it-work%0A */%0A%0A
 class En
@@ -477,16 +477,23 @@
  value: 
+Number(
 SafeStri
@@ -502,16 +502,17 @@
 ify(msg)
+)
 %0A      %7D

Improve serialization performance by V8 trick