Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

string-raw

59naga83.5kMITdeprecated1.0.1

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

a ponyfill for the ES6 String.raw()

String.raw, ponyfill, polyfill

readme

String Raw

Installation

npm install string-raw --save

Usage

It behaves just as String.raw.

const stringRaw = require('string-raw');

const arg1 = 'foo';
const arg2 = 'bar';

stringRaw``; // ""
stringRaw`hoge`; // "hoge"
stringRaw`hoge${arg1}`; // "hogefoo"
stringRaw`hoge${arg1}fuga${arg2}`; // hogefoofugabar
stringRaw`hoge${arg1}fuga${arg2}piyo`; // hogefoofugabarpiyo

stringRaw({ raw: [] }, arg1, arg2); // ""
stringRaw({ raw: ['hoge'] }, arg1, arg2); // "hoge"
stringRaw({ raw: ['hoge', 'fuga'] }, arg1, arg2); // "hogefoofuga"
stringRaw({ raw: ['hoge', 'fuga', 'piyo'] }, arg1, arg2); // "hogefoofugabarpiyo"

stringRaw({ raw: {} }, arg1, arg2); // ""
stringRaw({ raw: true }, arg1, arg2); // ""

stringRaw(); // TypeError: Cannot convert undefined or null to object
stringRaw(''); // TypeError: Cannot convert undefined or null to object
stringRaw(null); // TypeError: Cannot convert undefined or null to object
stringRaw({ raw: null }); // TypeError: Cannot convert undefined or null to object

Development

Requirement global

  • NodeJS v5.10.0
  • Npm v3.8.3
git clone https://github.com/59naga/string-raw
cd string-raw
npm install

npm test

License

MIT