Socket
Socket
Sign inDemoInstall

serialise-response

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    serialise-response

Serialise and deserialise HTML5 Responses


Version published
Weekly downloads
136
decreased by-48.87%
Maintainers
1
Install size
9.54 kB
Created
Weekly downloads
 

Readme

Source

serialise-response

Serialise and de-serialise HTML5 Responses

Made with ❤ at @outlandish

npm version js-standard-style

Install

npm install serialise-response --save

Import

ES6 Import (w/ Babel)

import serialiseResponse from 'serialise-response'

CommonJS Require

var serialiseResponse = require('serialise-response')

AMD

define(['serialiseResponse'], ...)

Script

<script src="/node_modules/serialise-response/dist/serialise-response.min.js"></script>
typeof window.serialiseResponse === 'object'

Usage

serialiseResponse(response[, toObject]) : String|Object

  • response {Response} responseto serialise
  • toObject {Boolean} serialise response to an object (default is string)

serialiseResponse.deserialise(response) : Promise<Response>

  • response {String|Object} serialised response to deserialise

Function names are also made available in American English: serializeResponse and serializeResponse.deserialize

Example

import serialiseResponse from 'serialise-response'

const serialisedResponse = serialiseResponse({ foo: 'bar' }))

// ...

const response = serialisedResponse.deserialise(serialisedResponse)

request.json().then((data) => {
  console.log(data) //=> { foo: bar }
})

What about serialising a Request?

Check out the serialise-request sibling module.

Contributing

All pull requests and issues welcome!

If you're not sure how, check out Kent C. Dodds' great video tutorials on egghead.io!

Keywords

FAQs

Last updated on 29 Feb 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc