Created
August 30, 2009 20:21
-
-
Save lsmith/178116 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 before = { | |
"12": "John", | |
"100": "Mary" | |
}; | |
var after = [], | |
k; | |
for (k in before) { | |
if (before.hasOwnProperty(k)) { | |
after.push({ value: k, label: before[k] }); | |
} | |
} | |
// after is now | |
[ | |
{ value: "12", label: "John" }, | |
{ value: "100", label: "Mary" } | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment