Skip to content

Commit

Permalink
faster replace
Browse files Browse the repository at this point in the history
  • Loading branch information
kbrsh committed May 5, 2017
1 parent d533fc9 commit 7d2f9ac
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions dist/moon.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@

/* ======= Global Utilities ======= */

var hashRE = /\[(\w+)\]/g;

/**
* Logs a Message
* @param {String} msg
Expand Down Expand Up @@ -203,9 +205,7 @@
*/
var resolveKeyPath = function (instance, obj, keypath, val) {
var i = null;
keypath.replace(/\[(\w+)\]/g, function (match, index) {
keypath = keypath.replace(match, '.' + index);
});
keypath = keypath.replace(hashRE, '.$1');
var path = keypath.split(".");
for (i = 0; i < path.length - 1; i++) {
var propName = path[i];
Expand Down
Loading

0 comments on commit 7d2f9ac

Please sign in to comment.