|
48 | 48 | }, |
49 | 49 |
|
50 | 50 | /** |
51 | | - * Find partials based on regex. |
| 51 | + * Find regex matches within both pattern strings and pattern objects. |
52 | 52 | * |
53 | 53 | * @param {string|object} pattern Either a string or a pattern object. |
54 | 54 | * @param {object} regex A JavaScript RegExp object. |
55 | 55 | * @returns {array|null} An array if a match is found, null if not. |
56 | 56 | */ |
57 | | - partialsFinder: function partialsFinder(pattern, regex){ |
| 57 | + patternMatcher: function patternMatcher(pattern, regex){ |
58 | 58 | var matches; |
59 | 59 |
|
60 | 60 | if(typeof pattern === 'string'){ |
|
67 | 67 | }, |
68 | 68 | // find and return any {{> template-name }} within pattern |
69 | 69 | findPartials: function findPartials(pattern) { |
70 | | - var matches = this.partialsFinder(pattern, this.findPartialsRE); |
| 70 | + var matches = this.patternMatcher(pattern, this.findPartialsRE); |
71 | 71 | return matches; |
72 | 72 | }, |
73 | 73 | findPartialsWithStyleModifiers: function(pattern) { |
74 | | - var matches = this.partialsFinder(pattern, this.findPartialsWithStyleModifiersRE); |
| 74 | + var matches = this.patternMatcher(pattern, this.findPartialsWithStyleModifiersRE); |
75 | 75 | return matches; |
76 | 76 | }, |
77 | 77 | // returns any patterns that match {{> value(foo:"bar") }} or {{> |
78 | 78 | // value:mod(foo:"bar") }} within the pattern |
79 | 79 | findPartialsWithPatternParameters: function(pattern) { |
80 | | - var matches = this.partialsFinder(pattern, this.findPartialsWithPatternParametersRE); |
| 80 | + var matches = this.patternMatcher(pattern, this.findPartialsWithPatternParametersRE); |
81 | 81 | return matches; |
82 | 82 | }, |
83 | 83 | findListItems: function(pattern) { |
84 | | - var matches = this.partialsFinder(pattern, this.findListItemsRE); |
| 84 | + var matches = this.patternMatcher(pattern, this.findListItemsRE); |
85 | 85 | return matches; |
86 | 86 | }, |
87 | 87 | // given a pattern, and a partial string, tease out the "pattern key" and |
|
0 commit comments