1.0.0 • Published 4 years ago

unwrap-jsonp v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

unwrap-jsonp Travis CI Build Status

Unwrap the values in a JSONP function.

NPM Badge

Install

npm install unwrap-jsonp

Usage

const unwrapJsonp = require("unwrap-jsonp")

unwrapJsonp(`fn({a: "b"})`)
//=> {a: "b"}

unwrapJsonp(`fn("a", "b")`, {multiArgs: true})
//=> ["a", "b"]

API

unwrapJsonp(data, options?)

data

Type: string

The jsonp to parse.

options

Type: object

multiArgs

Type: boolean\ Default: false

Return an array of the function arguments instead of just the first one.