Created
January 8, 2014 16:56
-
-
Save eloyz/8320106 to your computer and use it in GitHub Desktop.
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.js"></script> | |
<script src="http://builds.emberjs.com.s3.amazonaws.com/tags/v1.0.0/ember.js"></script> | |
<meta charset=utf-8 /> | |
<script src="https://bitbucket.org/cetir/catcher/raw/0199a325eb50128dbf68c4e6a90af87efd3cc8ae/static/catcher/js/data.utils.js"></script> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
</body> | |
</html> |
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
var str1 = 'patients/heart-rate'; | |
var str2 = 'patients/vitals/blood-presssure'; | |
var str3 = 'patients/vitals/blood-pressures/min'; | |
var lst = str1.camelize().split('/'); | |
// var lst = str2.camelize().split('/'); | |
// var lst = str3.camelize().split('/'); | |
console.log('length', lst.length); | |
if(lst.length === 2){ | |
attrName = lst[1]; | |
attrValue = 'primitive value'; | |
} else if(lst.length >= 2){ | |
console.log('greater'); | |
attrValue = {}; | |
lst.forEach(function(item){ | |
str = | |
attrValue[item]; | |
}); | |
} | |
// console.log(attrName, attrValue); | |
lst.forEach(function(item){ | |
// console.log(item); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment