Skip to content

Latest commit

 

History

History
20 lines (13 loc) · 752 Bytes

interpolate.md

File metadata and controls

20 lines (13 loc) · 752 Bytes

interpolate helper

🔝 REserve documentation

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 returned
    • object : property values are interpolated recursively and a new object is returned