npm.io
1.0.0 • Published 6 years ago

unwrap-jsonp

Licence
MIT
Version
1.0.0
Deps
0
Size
4 kB
Vulns
0
Weekly
0
Stars
1

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.

Keywords