Skip to content

Fails on native functions, like Number or String (SOLUTION INCLUDED) #179

Description

@TheJaredWilcurt

Steps to Reproduce:

const serializeJavaScript = require('serialize-javascript');

const input = {
  type: Number
};

const output = serializeJavaScript(input);

console.log(output);

Expected:

'{"type":Number}'

Actual:

Uncaught TypeError: Serializing native function: Number
    at serializeFunc (/node_modules/serialize-javascript/index.js:146:17)
    at /node_modules/serialize-javascript/index.js:266:16
    at String.replace (<anonymous>)
    at serialize (/node_modules/serialize-javascript/index.js:220:16)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions