poper
Install
yarn add poper
How does it work
It matches a starting comment /* @@variable */
and an ending comment /* variable@@ */
, finally it replaces the comments and content within using the data
you provide. The variable
supports dot path like foo.deep.key
Usage
const poper = const input = `{ hello: /* @@foo */ whatever.content(val) /* foo@@ */, there: /* @@bar */ what's this? /* bar@@ */}` //=> output: hello: 123 there: "hahaha"
API
poper(input, data, [options])
options
stringify
Type: function
Whether to replace matched content with stringified value using JSON.stringify
.
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Author
poper © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).
egoistian.com · GitHub @egoist · Twitter @rem_rin_rin