deep-template
Create "curried" templates from deep JS structures using ES6 template syntax
Install
In a browser:
Using npm:
$ npm i -g npm$ npm i --save deep-template
Usage
deepTemplate(String, Object) -> String
var deepTemplate = ;var buildPath = ;; // -> "/api/users/549873456448/"
deepTemplate(Object, Object) -> Object
var configTemplate = a: '/api/users/${id}/${action}' b: deep: foo: stuff: 'DEFAULT_ENV=${env}' { console } d: /keepRegExp/gim e: 'keep simple texts' f: 10;var defaults = action: 'defaultAction' env: '/usr/bin/bash';var configBuilder = ;; /* -> { a: ["/api/users/549873456448/defaultAction"], b: { deep: { foo: [{ stuff: "DEFAULT_ENV=/usr/bin/bash" }] } }, c: function() { console.log('avoided') }, d: /keepRegExp/gim, e: "keep simple texts", f: 10 }*/
deepTemplate(String, Array) -> String
var arrayBuildPath = ;; // -> "/api/users/549873456448/getUser/ascending"