Created
March 15, 2020 09:38
-
-
Save jmorenoamor/ab28b97f8848ed606141d37245a259b2 to your computer and use it in GitHub Desktop.
XML to JSON transformation sets one item lists to an object, this function forces a value to be a list instead of an object
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
| /* | |
| * XML to JSON transformation sets one item lists to an object | |
| * this function forces value to be a list instead of an object | |
| */ | |
| function assureArray(item) { | |
| return (item ? (Array.isArray(item) ? item : [item]) : []); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment