MCPcopy
hub / github.com/angular-ui/ui-grid / parseIsolateBindings

Function parseIsolateBindings

lib/test/angular/1.8.0/angular.js:8716–8751  ·  view source on GitHub ↗
(scope, directiveName, isController)

Source from the content-addressed store, hash-verified

8714 var bindingCache = createMap();
8715
8716 function parseIsolateBindings(scope, directiveName, isController) {
8717 var LOCAL_REGEXP = /^([@&]|[=<](\*?))(\??)\s*([\w$]*)$/;
8718
8719 var bindings = createMap();
8720
8721 forEach(scope, function(definition, scopeName) {
8722 definition = definition.trim();
8723
8724 if (definition in bindingCache) {
8725 bindings[scopeName] = bindingCache[definition];
8726 return;
8727 }
8728 var match = definition.match(LOCAL_REGEXP);
8729
8730 if (!match) {
8731 throw $compileMinErr('iscp',
8732 'Invalid {3} for directive \'{0}\'.' +
8733 ' Definition: {... {1}: \'{2}\' ...}',
8734 directiveName, scopeName, definition,
8735 (isController ? 'controller bindings definition' :
8736 'isolate scope definition'));
8737 }
8738
8739 bindings[scopeName] = {
8740 mode: match[1][0],
8741 collection: match[2] === '*',
8742 optional: match[3] === '?',
8743 attrName: match[4] || scopeName
8744 };
8745 if (match[4]) {
8746 bindingCache[definition] = bindings[scopeName];
8747 }
8748 });
8749
8750 return bindings;
8751 }
8752
8753 function parseDirectiveBindings(directive, directiveName) {
8754 var bindings = {

Callers 1

parseDirectiveBindingsFunction · 0.70

Calls 2

createMapFunction · 0.70
forEachFunction · 0.70

Tested by

no test coverage detected