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
20 lines (16 loc) • 457 B
JavaScript
const path = require('path');
const expect = require('chai').expect;
const frep = require('../');
describe('when a string is passed as a replacement pattern', function () {
it('should replace the first match.', function () {
var template = 'a[a+]b';
var replacements = [
{
pattern: '[a+]',
replacement: ''
}
];
var actual = frep.strWithArr(template, replacements);
expect(actual).to.eql('ab');
});
});