Skip to content

Commit eee3580

Browse files
committed
fix #20 callback not working without parenthese
1 parent c0b23e6 commit eee3580

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/angular-markdown-editor.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,21 @@ function runScopeFunction(scope, fnString, editorObject) {
179179
}
180180
}
181181
return result;
182+
}
183+
184+
/** Find a property inside an object.
185+
* If a delimiter is passed as argument, we will split the search ID before searching
186+
* @param object: source object
187+
* @param string: searchId
188+
* @return mixed: property found
189+
*/
190+
function objectFindById(sourceObject, searchId, delimiter) {
191+
var split = (!!delimiter) ? searchId.split(delimiter) : searchId;
192+
193+
for (var k = 0, kln = split.length; k < kln; k++) {
194+
if(!!sourceObject[split[k]]) {
195+
sourceObject = sourceObject[split[k]];
196+
}
197+
}
198+
return sourceObject;
182199
}

0 commit comments

Comments
 (0)