Package Exports
- q-set
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (q-set) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Q-Set
Set query string style fields on an object.
Installation
Npm
npm install q-set
Bower
bower install q-set
Example
var set = require('q-set');
set({}, "a", 1); //-> { a: 1 }
set({}, "a[b]", 1); //-> { a: { b: 1 } }
set({}, "a[]", 1); //-> { a: [1] }
Utilities
- flatten(obj) : Converts a nested object into on with questring style keys.
var result = set.flatten({ a: { b: 1 }, c: { d: 1 } });
result; //-> { "a[b]": 1, "c[d]": 1 }
- unflatten(obj) : Converts an object with querystring style keys into a regular nested object.
var result = set.unflatten({ "a[b]": 1, "c[d]": 1 });
result; //-> { a: { b: 1 }, c: { d: 1 } }
Contributions
- Use gulp to run tests.
Please feel free to create a PR!