Last active
December 26, 2015 07:18
-
-
Save xavi-/7113797 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var original = { | |
_id: "3f369ef", | |
_rev: "rev-23421-12", | |
brand: "bran and ed", | |
sizes: [ | |
{ sku: "3925", US: 10, UK: 11 }, | |
{ sku: "4635", US: 9, UK: 10 } | |
] | |
}; | |
var tmpl = { | |
id: "@._id", | |
brand: "@.brand", | |
sizes: "@.sizes[].US" | |
}; | |
var sanitized = magic(original, tmpl); | |
sanitized === { | |
id: "3f369ef", | |
brand: "bran and ed", | |
sizes: [ 10, 9 ] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment