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

Package detail

string-objectreplaceprefix

nodef18MIT0.1.5

Replace prefix of string using object.

string, object, replace, prefix

readme

string-objectreplaceprefix

NOTE: string-objectreplaceprefix was renamed to @extra-string/object-replace-prefix. NPM

Replace prefix of string using object.

const objectReplacePrefix = require('string-objectreplaceprefix');
// objectReplacePrefix(<string>, <object>, [max prefix length])

objectReplacePrefix('dishonoured', {'dis': '', 'un': '', 'in': ''});
// 'honoured'
objectReplacePrefix('dishonoured', {'honour': 'respect', 'flatter': 'mock'});
// 'dishonoured' (only prefix)
objectReplacePrefix('dishonoured', {'dis': 'redis', 'redis': 'super'}, 5);
// 'redishonoured' (only once)