MCPcopy Create free account
hub / github.com/RubyLouvre/anu / update

Function update

test/babel.js:57282–57299  ·  view source on GitHub ↗
(item, pattern)

Source from the content-addressed store, hash-verified

57280 }
57281
57282 function update(item, pattern) {
57283 // TODO: Test if memoizing `pattern` here is worth the effort.
57284 if (!pattern) {
57285 return;
57286 }
57287 var tree = parse(pattern, '');
57288 switch (tree.type) {
57289 case 'characterClass':
57290 case 'group':
57291 case 'value':
57292 // No wrapping needed.
57293 break;
57294 default:
57295 // Wrap the pattern in a non-capturing group.
57296 tree = wrap(tree, pattern);
57297 }
57298 assign(item, tree);
57299 }
57300
57301 function wrap(tree, pattern) {
57302 // Wrap the pattern in a non-capturing group.

Callers 2

processCharacterClassFunction · 0.70
processTermFunction · 0.70

Calls 3

wrapFunction · 0.85
assignFunction · 0.85
parseFunction · 0.70

Tested by

no test coverage detected