-
Notifications
You must be signed in to change notification settings - Fork 0
gabrielgilini/jsextract
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is an attempt to build a XPath data extractor which could be useful on handling JSON API's responses. Given an array: var arr = [ { 'foo': 'bar', 'baz': { 'theNumber' : 42 } }, { 'foo': 'bar', 'baz': { 'theNumber' : 84 } }, { 'foo': 'bar', 'baz': { 'theNumber' : 168 } }, { 'foo': 'bar', 'baz': { 'theNumber' : 336 } } ]; extract would be used as: var extracted = extract('/baz/theNumber', arr); Yielding - [ 42, 84, 168, 336 ] Check out the index file to see it in action, extracting data from a REST request on Flickr's API
About
JavaScript function similar to CakePHP's Set::extract, uses XPath syntax to extract data subsets from an iterable
Resources
Stars
Watchers
Forks
Releases
No releases published