Skip to content

Instantly share code, notes, and snippets.

View roboncode's full-sized avatar

Rob Taylor roboncode

View GitHub Profile
@roboncode
roboncode / supplant.js
Last active July 12, 2016 13:58 — forked from pbroschwitz/supplant.js
supplant - Crockford
/**
* supplant() does variable substitution on the string. It scans through the string looking for
* expressions enclosed in { } braces. If an expression is found, use it as a key on the object,
* and if the key has a string value or number value, it is substituted for the bracket expression
* and it repeats.
*
* Updated by Rob Taylor
* http://roboncode.com
*
* Originally written by Douglas Crockford