Add trimChars fp mapping.

This commit is contained in:
John-David Dalton
2016-02-02 08:31:40 -08:00
parent f944254cb8
commit 33bfa8f961
3 changed files with 35 additions and 6 deletions

View File

@@ -993,6 +993,32 @@
/*--------------------------------------------------------------------------*/
QUnit.module('fp.trimChars');
_.each(['trimChars', 'trimCharsStart', 'trimCharsEnd'], function(methodName, index) {
var func = fp[methodName],
parts = [];
if (index != 2) {
parts.push('leading');
}
if (index != 1) {
parts.push('trailing');
}
parts = parts.join(' and ');
QUnit.test('`_.' + methodName + '` should remove ' + parts + ' `chars`', function(assert) {
assert.expect(1);
var string = '-_-a-b-c-_-',
expected = (index == 2 ? '-_-' : '') + 'a-b-c' + (index == 1 ? '-_-' : '');
assert.strictEqual(func('_-')(string), expected);
});
});
/*--------------------------------------------------------------------------*/
QUnit.module('fp.uniqBy');
(function() {

View File

@@ -21457,9 +21457,9 @@
QUnit.module('trim methods');
lodashStable.each(['trim', 'trimStart', 'trimEnd'], function(methodName, index) {
var func = _[methodName];
var func = _[methodName],
parts = [];
var parts = [];
if (index != 2) {
parts.push('leading');
}