MCPcopy Index your code
hub / github.com/angular-ui/ui-router / parseIsolateBindings

Function parseIsolateBindings

test/angular/1.6/angular.js:8204–8239  ·  view source on GitHub ↗
(scope, directiveName, isController)

Source from the content-addressed store, hash-verified

8202 var bindingCache = createMap();
8203
8204 function parseIsolateBindings(scope, directiveName, isController) {
8205 var LOCAL_REGEXP = /^([@&<]|=(\*?))(\??)\s*([\w$]*)$/;
8206
8207 var bindings = createMap();
8208
8209 forEach(scope, function(definition, scopeName) {
8210 definition = definition.trim();
8211
8212 if (definition in bindingCache) {
8213 bindings[scopeName] = bindingCache[definition];
8214 return;
8215 }
8216 var match = definition.match(LOCAL_REGEXP);
8217
8218 if (!match) {
8219 throw $compileMinErr('iscp',
8220 'Invalid {3} for directive \'{0}\'.' +
8221 ' Definition: {... {1}: \'{2}\' ...}',
8222 directiveName, scopeName, definition,
8223 (isController ? 'controller bindings definition' :
8224 'isolate scope definition'));
8225 }
8226
8227 bindings[scopeName] = {
8228 mode: match[1][0],
8229 collection: match[2] === '*',
8230 optional: match[3] === '?',
8231 attrName: match[4] || scopeName
8232 };
8233 if (match[4]) {
8234 bindingCache[definition] = bindings[scopeName];
8235 }
8236 });
8237
8238 return bindings;
8239 }
8240
8241 function parseDirectiveBindings(directive, directiveName) {
8242 var bindings = {

Callers 1

parseDirectiveBindingsFunction · 0.70

Calls 3

matchMethod · 0.80
createMapFunction · 0.70
forEachFunction · 0.70

Tested by

no test coverage detected