There was an error while loading. Please reload this page.
Replace prefix of string using map.
const mapReplacePrefix = require('@extra-string/map-replace-prefix'); // mapReplacePrefix(<string>, <map>, [max prefix length]) mapReplacePrefix('dishonoured', new Map([['dis', ''], ['un', ''], ['in', '']])); // 'honoured' mapReplacePrefix('dishonoured', new Map([['honour', 'respect'], ['flatter', 'mock']])); // 'dishonoured' (only prefix) mapReplacePrefix('dishonoured', new Map([['dis', 'redis'], ['redis', 'super']]), 5); // 'redishonoured' (only once)