REserve offers a method to interpolate values in a string or an object, enabling the writing of patterns.
function interpolate (match: RegExpMatchArray, pattern: string): string
function interpolate (match: RegExpMatchArray, pattern: object): object
Types definition for
interpolate
The method accepts two parameters:
-
match the regular expression exec result
-
pattern accepting multiple types :
string
: value is interpolated and the result returnedobject
: property values are interpolated recursively and a new object is returned