Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ampersand-jsonapi-model

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ampersand-jsonapi-model

An extension to ampersand-model that adds methods and properties for working with JSON-API.

  • 2.0.2
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

ampersand-jsonapi-model

AmpersandJSONAPIModel is a JSON-API-compatible extension of the AmpersandJS Model.

It achieves this JSON-API compatibility by overriding select methods within ampersand-model and adding appropriate HTTP headers to requests.

Installing

npm install ampersand-jsonapi-model

API Reference

Except as described below, AmpersandJSONAPIModel has the same interface as AmpersandModel and AmpersandState.

To ensure this, AmpersandJSONAPIModel passes all tests for AmpersandModel (version 6.0.2).

The following methods have been overridden:

getAttributes model.getAttributes([options, raw])

This adds additional options for returning children and collections along with the standard session, props, and derived options.

parse model.parse(data)

This has been augmented to parse JSON-API formatted data: specifically a format in which model attributes are nested within the structure { data: { attributes: {} } }.

save model.save([attributes], [options])

This has been augmented in order to handle the special structure and additional relationship data included in saving to a JSON-API-compatible server.

serialize model.serialize()

This has been augmented in order to serialize data into the correct format expected by JSON-API.

Keywords

FAQs

Package last updated on 02 Dec 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc