caverav / auditforge

Require rest parameters instead of arguments JS-0244
Anti-pattern
Minor
11 days ago11 days old
Use the rest parameters instead of 'arguments'
134// Filters helper: handles the use of preformated easilly translatable strings.
135// Source: https://www.tutorialstonight.com/javascript-string-format.php
136String.prototype.format = function () {
137  let args = arguments;138  return this.replace(/{([0-9]+)}/g, function (match, index) {
139    return typeof args[index] == 'undefined' ? match : args[index];
140  });
Use the rest parameters instead of 'arguments'
284
285// Applies a filter on a sequence of objects: {scope | select: 'name' | map: 'lower' | join: ', '}
286expressions.filters.map = function (input, filter) {
287  let args = Array.prototype.slice.call(arguments, 2);288  return input.map(x => expressions.filters[filter](x, ...args));
289};
290