Module: js-whatever/js/substitution

js-whatever/js/substitution

require("js-whatever/js/substitution")(i18n) → {object}

Interpolates placeholders of the form {n} in strings, turning the strings into functions and allowing
arguments to be passed in to hide string concatenation

Parameters:
Name Type Description
i18n object

Object containing strings to interpolate

Source:
Returns:

A copy of i18n where the strings containing the interpolation pattern have become functions

Type
object
Example
var i18n = {
    foo: 'Substitution {0}, {1}'
};

var substitutedI18n = substitution(i18n);

substitutedI18n.foo('works', 'like this'); // returns 'Substitution works, like this'
Source:
Copyright 2013-2018 Micro Focus International plc. Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
Documentation generated by JSDoc 3.4.3 on Thu Jun 21st 18:04 2018 using the DocStrap template.