UNPKG

frep

Version:

Find and replace utility for node.js. Transform strings by running multiple RegExp or string find-and-replace patterns on a string in sequence, reducing the final string to the accumulated result of each transformation. Patterns can be strings (or arrays

22 lines (18 loc) 494 B
var path = require('path'); var expect = require('chai').expect; var frep = require('../'); describe('when an object of replacement patterns is passed', function () { it('should replace the first match.', function () { var pattern = 'ABC' var replacements = { 'A': 'AAA', 'B': 'BBB', 'C': 'CCC', 'D': 'DDD', 'E': 'EEE', 'F': 'FFF' }; var actual = frep.strWithObj(pattern, replacements); expect(actual).to.eql('AAABBBCCC'); }); });