mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 11:57:49 +00:00
Add trimChars fp mapping.
This commit is contained in:
@@ -60,9 +60,9 @@ exports.aryMethod = {
|
|||||||
'repeat', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
|
'repeat', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
|
||||||
'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
|
'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
|
||||||
'split', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight', 'takeRightWhile',
|
'split', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight', 'takeRightWhile',
|
||||||
'takeWhile', 'tap', 'throttle', 'thru', 'times', 'truncate', 'union', 'uniqBy',
|
'takeWhile', 'tap', 'throttle', 'thru', 'times', 'trimChars', 'trimCharsEnd',
|
||||||
'uniqWith', 'unset', 'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject',
|
'trimCharsStart', 'truncate', 'union', 'uniqBy', 'uniqWith', 'unset',
|
||||||
'zipObjectDeep'
|
'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject', 'zipObjectDeep'
|
||||||
],
|
],
|
||||||
3: [
|
3: [
|
||||||
'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
|
'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
|
||||||
@@ -212,7 +212,10 @@ exports.realToAlias = (function() {
|
|||||||
exports.rename = {
|
exports.rename = {
|
||||||
'curryN': 'curry',
|
'curryN': 'curry',
|
||||||
'curryRightN': 'curryRight',
|
'curryRightN': 'curryRight',
|
||||||
'getOr': 'get'
|
'getOr': 'get',
|
||||||
|
'trimChars': 'trim',
|
||||||
|
'trimCharsEnd': 'trimEnd',
|
||||||
|
'trimCharsStart': 'trimStart'
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Used to track methods that skip `_.rearg`. */
|
/** Used to track methods that skip `_.rearg`. */
|
||||||
|
|||||||
@@ -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');
|
QUnit.module('fp.uniqBy');
|
||||||
|
|
||||||
(function() {
|
(function() {
|
||||||
|
|||||||
@@ -21457,9 +21457,9 @@
|
|||||||
QUnit.module('trim methods');
|
QUnit.module('trim methods');
|
||||||
|
|
||||||
lodashStable.each(['trim', 'trimStart', 'trimEnd'], function(methodName, index) {
|
lodashStable.each(['trim', 'trimStart', 'trimEnd'], function(methodName, index) {
|
||||||
var func = _[methodName];
|
var func = _[methodName],
|
||||||
|
parts = [];
|
||||||
|
|
||||||
var parts = [];
|
|
||||||
if (index != 2) {
|
if (index != 2) {
|
||||||
parts.push('leading');
|
parts.push('leading');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user