Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/derhuerst/parse-jsonp
Get the payload of a JSONP response.
https://github.com/derhuerst/parse-jsonp
ajax cors fetch jsonp
Last synced: 5 days ago
JSON representation
Get the payload of a JSONP response.
- Host: GitHub
- URL: https://github.com/derhuerst/parse-jsonp
- Owner: derhuerst
- License: isc
- Created: 2017-07-20T17:47:24.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-05-12T01:56:14.000Z (over 4 years ago)
- Last Synced: 2024-10-03T23:56:56.163Z (about 1 month ago)
- Topics: ajax, cors, fetch, jsonp
- Language: JavaScript
- Homepage: https://github.com/derhuerst/parse-jsonp
- Size: 99.6 KB
- Stars: 7
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: license.md
Awesome Lists containing this project
README
# parse-jsonp
**Get the payload of a [JSONP](https://en.wikipedia.org/wiki/JSONP) response** in Node.js and in the browser. No `fetch`/AJAX logic in here.
[![npm version](https://img.shields.io/npm/v/parse-jsonp.svg)](https://www.npmjs.com/package/parse-jsonp)
[![build status](https://img.shields.io/travis/derhuerst/parse-jsonp.svg)](https://travis-ci.org/derhuerst/parse-jsonp)
![ISC-licensed](https://img.shields.io/github/license/derhuerst/parse-jsonp.svg)
[![chat on gitter](https://badges.gitter.im/derhuerst.svg)](https://gitter.im/derhuerst)
[![support me on Patreon](https://img.shields.io/badge/support%20me-on%20patreon-fa7664.svg)](https://patreon.com/derhuerst)## Installing
```shell
npm install parse-jsonp
```## Usage
```js
const {fetch} = require('fetch-ponyfill')()
const parse = require('parse-jsonp')fetch('some-JSONP-url.js')
.then((res) => res.text())
.then((jsonp) => parse('callback', jsonp))
.then(console.log, console.error)
```## API
```js
parse(hook, jsonp)
```## Contributing
If you have a question or have difficulties using `parse-jsonp`, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, refer to [the issues page](https://github.com/derhuerst/parse-jsonp/issues).