MCPcopy Create free account
hub / github.com/SlexAxton/listpattern / formatLiteralPattern

Function formatLiteralPattern

index.js:32–42  ·  view source on GitHub ↗
(list, listPattern)

Source from the content-addressed store, hash-verified

30
31// Logic to format the literal length rules (e.g. "2": "{0} and {1}")
32function formatLiteralPattern(list, listPattern) {
33 // The string we'll build up
34 var result = listPattern;
35
36 // This means we have a special handling for just this number of elements
37 list.forEach(function(listItem, idx) {
38 result = result.replace('{' + idx + '}', listItem);
39 });
40
41 return result;
42}
43
44function listPatternFormatter(list, _config) {
45 // Use the default config patternType by default…

Callers 1

listPatternFormatterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected