39 lines
2.2 KiB
Diff
39 lines
2.2 KiB
Diff
commit 4e753d5485afa20ab24d24e59db5496a8d2bf44c
|
|
Author: Tom Hughes <tom@compton.nu>
|
|
Date: Thu Mar 15 11:29:05 2018 +0000
|
|
|
|
Remove U+180E MONGOLIAN VOWEL SEPARATOR from whitespace characters
|
|
|
|
Unicode 6.3.0 changed this character from the Zs "Separator, space"
|
|
category to the Cf "Other, format" category and Node.js has apparently
|
|
now caught up and no longer considers it a space character.
|
|
|
|
diff --git a/implementation.js b/implementation.js
|
|
index 304246c..42e7cba 100644
|
|
--- a/implementation.js
|
|
+++ b/implementation.js
|
|
@@ -4,8 +4,8 @@ var bind = require('function-bind');
|
|
var ES = require('es-abstract/es5');
|
|
var replace = bind.call(Function.call, String.prototype.replace);
|
|
|
|
-var leftWhitespace = /^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/;
|
|
-var rightWhitespace = /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;
|
|
+var leftWhitespace = /^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/;
|
|
+var rightWhitespace = /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;
|
|
|
|
module.exports = function trim() {
|
|
var S = ES.ToString(ES.CheckObjectCoercible(this));
|
|
diff --git a/test/tests.js b/test/tests.js
|
|
index 6e3889c..8de60bf 100644
|
|
--- a/test/tests.js
|
|
+++ b/test/tests.js
|
|
@@ -5,7 +5,7 @@ module.exports = function (trim, t) {
|
|
st.equal(trim(' \t\na \t\n'), 'a', 'strips whitespace off left and right sides');
|
|
st.equal(trim('a'), 'a', 'noop when no whitespace');
|
|
|
|
- var allWhitespaceChars = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
|
+ var allWhitespaceChars = '\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
|
st.equal(trim(allWhitespaceChars + 'a' + allWhitespaceChars), 'a', 'all expected whitespace chars are trimmed');
|
|
|
|
st.end();
|