diff options
author | Amine El Baghdadi <75886237+NoobJsPerson@users.noreply.github.com> | 2021-05-15 18:29:33 +0000 |
---|---|---|
committer | Amine El Baghdadi <75886237+NoobJsPerson@users.noreply.github.com> | 2021-05-15 18:29:33 +0000 |
commit | 12b56ae0c3980eb786fc8a9f2ca44a9a72392dac (patch) | |
tree | 7f294527f508f330b6e5894654984666379f2d60 | |
parent | 3ff1e092aa759182c1e5f9335f0a8889ce373c68 (diff) |
delete interpolate.js
-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 |