javascript - Underscore extend with dot.notation quotes are removed, How to get it with quotes? -


here example:

var 1 = {test: 'test'}; var 2 = {'test.test': 'test inside test'};  console.log(_.extend(one, two)) 

http://jsfiddle.net/nmnck67b/

the extended object return test.test: 'test inside test' bad me because i'm looking use mongodb , need make sure it's 'test.test' quotes. way return or super simple solution add quotes?

make single-quote part of string using double-quote around or escaping second inner-set of single quotes.

var 2 = {"'test.test'": 'test inside test'}; 

or:

var 2 = {'\'test.test\'': 'test inside test'}; 

http://jsfiddle.net/nmnck67b/1/


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -