diff options
-rw-r--r-- | interpolate.js | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/interpolate.js b/interpolate.js deleted file mode 100644 index 0c20589..0000000 --- a/interpolate.js +++ /dev/null @@ -1,11 +0,0 @@ -export default function interpolate(template, variables) {
- return template.replace(/\${[^{]+}/g, (match) => {
- const path = match.slice(2, -1).trim();
- return getObjPath(path, variables);
- });
-}
-
-//get the specified property or nested property of an object
-function getObjPath(path, obj) {
- return path.split('.').reduce((res, key) => res[key], obj);
-}
\ No newline at end of file |