Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ampersand-collection-rest-mixin
Advanced tools
A mixin for extending ampersand-collection with restful methods.
Part of the Ampersand.js toolkit for building clientside applications.
A mixin for extending ampersand-collection with restful methods. To make it behave much like Backbone.
npm install ampersand-collection-rest-mixin
Create a new instance of a model in this collection. Add the model to the collection immediately.
wait
- default: false
. If set to true, we wait for the server to agree before updating the collection.Fetch the default set of models for this collection, and set them onto this collection.
reset
[boolean] - default: false
. Executes the reset
method on the collection with server response instead of the set method.set
[boolean] - defaut: true
. When left true, executes the reset
method on the collection with server response. When set to false, the collection will not be modified after the HTTP request is complete. This enables use of of the collection strictly as an API client. The success
and error
handlers are still triggered. Useful in rare circumstances.success(collection, response, options)
[function] - default: undefined
. Called after the XHR has completed successfully and the collection is updated.error(model, response, options)
[function] - default: undefined
. Called after the XHR has failed.always(err, response, body)
[function] - default: undefined
. Called when request finishes no matter what the result.fetches a model and adds it to collection when fetched
get or fetch a model by id
same options as fetch()
, with the addition of:
all
[boolean] - default: false
. If true
, this fetches the entire collection and then returns the requested model.proxy to ampersand-sync
var Collection = require('ampersand-collection');
var restMixin = require('ampersand-collection-rest-mixin');
module.exports = Collection.extend(restMixin, {
sampleMethod: function () {
// now we've got restful methods in our collection
this.sync( ... );
this.fetch( ... );
this.create( ... )
}
});
All credit for this approach in backbone goes to Jeremy Ashkenas and the rest of the Backbone and Underscore authors.
MIT
FAQs
A mixin for extending ampersand-collection with restful methods.
The npm package ampersand-collection-rest-mixin receives a total of 1,687 weekly downloads. As such, ampersand-collection-rest-mixin popularity was classified as popular.
We found that ampersand-collection-rest-mixin demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.