Created
December 2, 2013 07:51
-
-
Save anasnakawa/7746381 to your computer and use it in GitHub Desktop.
parse binding attribute, the knockout way
This file contains 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
// parse a data-bind attribute | |
// | |
// @param {string} attr | |
// @return {object} parsed binding object | |
// | |
// examples: | |
// --------- | |
// parseBindings( 'something: { cool: true }' ); // { something: { cool: true } } | |
function parseBindings( attr ) { | |
return new Function( "return { " + attr + " };" )(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment