1.0.0 • Published 5 years ago

@kingjs/string-ex.expand v1.0.0

Weekly downloads
2
License
MIT
Repository
-
Last release
5 years ago

@kingjs/string-ex.expand

Given a string with the format of a template literal, expand its placeholders with the values corresponding to a descriptor's keys.

Usage

var assert = require('assert');
var Expand = require('@kingjs/string-ex.expand');

var foo = 'bar';
var result = 'Key "foo" is "${foo}"'[Expand]({ foo });
assert('Key "foo" is "bar"' == result);

API

expand(this[, descriptor])

Parameters

  • this: A string with the format of a template literal.
  • descriptor: The values to substitute for the placeholders in this.

Returns

A string whose placeholder have been replaced with the values of the corresponding descriptor keys.

Install

With npm installed, run

$ npm install @kingjs/string-ex.expand

Source

https://repository.kingjs.net/string-ex/expand

License

MIT

Analytics