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

Function parseIsolateBindings

lib/test/angular/1.6.7/angular.js:8131–8164  ·  view source on GitHub ↗
(scope, directiveName, isController)

Source from the content-addressed store, hash-verified

8129 var bindingCache = createMap();
8130
8131 function parseIsolateBindings(scope, directiveName, isController) {
8132 var LOCAL_REGEXP = /^\s*([@&<]|=(\*?))(\??)\s*([\w$]*)\s*$/;
8133
8134 var bindings = createMap();
8135
8136 forEach(scope, function(definition, scopeName) {
8137 if (definition in bindingCache) {
8138 bindings[scopeName] = bindingCache[definition];
8139 return;
8140 }
8141 var match = definition.match(LOCAL_REGEXP);
8142
8143 if (!match) {
8144 throw $compileMinErr('iscp',
8145 'Invalid {3} for directive \'{0}\'.' +
8146 ' Definition: {... {1}: \'{2}\' ...}',
8147 directiveName, scopeName, definition,
8148 (isController ? 'controller bindings definition' :
8149 'isolate scope definition'));
8150 }
8151
8152 bindings[scopeName] = {
8153 mode: match[1][0],
8154 collection: match[2] === '*',
8155 optional: match[3] === '?',
8156 attrName: match[4] || scopeName
8157 };
8158 if (match[4]) {
8159 bindingCache[definition] = bindings[scopeName];
8160 }
8161 });
8162
8163 return bindings;
8164 }
8165
8166 function parseDirectiveBindings(directive, directiveName) {
8167 var bindings = {

Callers 1

parseDirectiveBindingsFunction · 0.70

Calls 2

createMapFunction · 0.70
forEachFunction · 0.70

Tested by

no test coverage detected