mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 19:37:49 +00:00
Ensure punctuation is not treated as words. [closes #2268]
This commit is contained in:
@@ -180,11 +180,11 @@
|
|||||||
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
|
rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff',
|
||||||
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
|
rsMathOpRange = '\\xac\\xb1\\xd7\\xf7',
|
||||||
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
|
rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf',
|
||||||
rsQuoteRange = '\\u2018\\u2019\\u201c\\u201d',
|
rsPunctuationRange = '\\u2000-\\u206f',
|
||||||
rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
|
rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000',
|
||||||
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
|
rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde',
|
||||||
rsVarRange = '\\ufe0e\\ufe0f',
|
rsVarRange = '\\ufe0e\\ufe0f',
|
||||||
rsBreakRange = rsMathOpRange + rsNonCharRange + rsQuoteRange + rsSpaceRange;
|
rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
|
||||||
|
|
||||||
/** Used to compose unicode capture groups. */
|
/** Used to compose unicode capture groups. */
|
||||||
var rsApos = "['\u2019]",
|
var rsApos = "['\u2019]",
|
||||||
|
|||||||
15
test/test.js
15
test/test.js
@@ -24685,6 +24685,21 @@
|
|||||||
assert.deepEqual(actual, expected);
|
assert.deepEqual(actual, expected);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QUnit.test('should not treat punctuation as words', function(assert) {
|
||||||
|
assert.expect(1);
|
||||||
|
|
||||||
|
var marks = [
|
||||||
|
'\u2012', '\u2013', '\u2014', '\u2015',
|
||||||
|
'\u2024', '\u2025', '\u2026',
|
||||||
|
'\u205d', '\u205e'
|
||||||
|
];
|
||||||
|
|
||||||
|
var expected = lodashStable.map(marks, alwaysEmptyArray),
|
||||||
|
actual = lodashStable.map(marks, _.words);
|
||||||
|
|
||||||
|
assert.deepEqual(actual, expected);
|
||||||
|
});
|
||||||
|
|
||||||
QUnit.test('should support a `pattern` argument', function(assert) {
|
QUnit.test('should support a `pattern` argument', function(assert) {
|
||||||
assert.expect(2);
|
assert.expect(2);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user