![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
backbone-jsonify
Advanced tools
Backbone helper that alters "toJson" function to extend functionalities.
Backbone Jsonify alters and provides a extended configuration to the "toJSON" method for models and collections. In general terms, the library enhances it by the following features:
The new configuration options accepted by "toJSON" function are described below:
model.toJSON([options])
String, String[], Boolean, or Function. Returns the object which represents the model but only picks the provided attribute/s.
The function looks through each attribute in the model, and picks all the attributes that pass a truth test defined by the function, which is invoked with up to three arguments; (value [, index|key, object]).
String, String[], Boolean or Function. Returns the object which represents the model but omits the provided attribute/s.
The function looks through each attribute in the model, and omits all the attributes that pass a truth test defined by the function, which is invoked with up to three arguments; (value [, index|key, object]).
Boolean. Whether or not to copy deeply model's attributes which are array or objects.
var artist = new Backbone.Model({
firstName: "Wassily",
lastName: "Kandinsky"
});
artist.toJSON({
pick: "firstName" // Only picks firstName
}); // Outputs {firstName: "Wassily"}
artist.toJSON({
omit: "firstName" // Omits firstName
}); // Outputs {lastName: "Kandinsky"}
artist.set({age: 26});
artist.toJSON({
pick: function(attrKey, attrValue) { // Only picks firstName and attribute values that are numbers
return (attrKey == "firstName") || _.isNumber(attrValue);
}
}); // Outputs {firstName: "Wassily", age: 26}
artist.toJSON({
omit: function(attrKey, attrValue) { // Omits firstName and attribute values that are numbers
return (attrKey == "firstName") || _.isNumber(attrValue);
}
}); // Outputs {lastName: "Kandinsky"}
Supermodel is a Backbone plugin for model tracking and relationships between models. Backbone.Jsonify has been adapted to work along such library and it provides more options to address the jsonify process of the relationships.
For using it, it is needed to include the Supermodel library just before supermodel.jsonify.js or the minimized version of the plugin.
Serialices the model associations by a configuration.
Object representing:
{
'*': defaultConfiguration, // Takes a default configuration for all associations (optional)
associationName : configuration,
// [...] more association configs
}
The Configuration may accept a boolean or an object.
or a Function invoked with the following interface:
function (assocName, model)
and tests which associations it must include.
A Function that tests which attributes for each association must be included.
function (assocName, value, key, model)
A Function that tests which attributes for each association must be excluded.
function (assocName, value, key, model)
Boolean. Performs a deep serialization of the model and the relationships.
First install locally all the required development dependencies.
npm install
grunt
grunt base
grunt supermodel
grunt test
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.
Read the CHANGELOG.md file distributed with the project.
Read the LICENSE-MIT file distributed with the project.
FAQs
Backbone helper that alters "toJson" function to extend functionalities.
The npm package backbone-jsonify receives a total of 1 weekly downloads. As such, backbone-jsonify popularity was classified as not popular.
We found that backbone-jsonify demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.