diff --git a/nodejs-string-dot-prototype-dot-trim-unicode630.patch b/nodejs-string-dot-prototype-dot-trim-unicode630.patch new file mode 100644 index 0000000..f0c2670 --- /dev/null +++ b/nodejs-string-dot-prototype-dot-trim-unicode630.patch @@ -0,0 +1,38 @@ +commit 4e753d5485afa20ab24d24e59db5496a8d2bf44c +Author: Tom Hughes +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(); diff --git a/nodejs-string-dot-prototype-dot-trim.spec b/nodejs-string-dot-prototype-dot-trim.spec new file mode 100644 index 0000000..b64cfe2 --- /dev/null +++ b/nodejs-string-dot-prototype-dot-trim.spec @@ -0,0 +1,41 @@ +%{?nodejs_find_provides_and_requires} +Name: nodejs-string-dot-prototype-dot-trim +Version: 1.1.2 +Release: 1 +Summary: ES5 spec-compliant shim for String.prototype.trim +License: MIT +URL: https://github.com/es-shims/String.prototype.trim +Source0: https://registry.npmjs.org/string.prototype.trim/-/string.prototype.trim-%{version}.tgz +Patch1: nodejs-string-dot-prototype-dot-trim-unicode630.patch +BuildArch: noarch +ExclusiveArch: %{nodejs_arches} noarch +BuildRequires: nodejs-packaging +BuildRequires: npm(tape) npm(define-properties) npm(es-abstract) npm(function-bind) +%description +An ES5 spec-compliant String.prototype.trim shim. Invoke its "shim" +method to shim String.prototype.trim if it is unavailable. + +%prep +%autosetup -p 1 -n package +rm -rf node_modules + +%build + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/string.prototype.trim +cp -pr package.json *.js %{buildroot}%{nodejs_sitelib}/string.prototype.trim +%nodejs_symlink_deps + +%check +%nodejs_symlink_deps --check +%__nodejs test/shimmed.js +%__nodejs test/index.js + +%files +%doc README.md +%license LICENSE +%{nodejs_sitelib}/string.prototype.trim + +%changelog +* Thu Aug 20 2020 wangyue - 1.1.2-1 +- package init diff --git a/nodejs-string-dot-prototype-dot-trim.yaml b/nodejs-string-dot-prototype-dot-trim.yaml new file mode 100644 index 0000000..205da8c --- /dev/null +++ b/nodejs-string-dot-prototype-dot-trim.yaml @@ -0,0 +1,5 @@ +git_url: https://github.com/es-shims/String.prototype.trim +version_control: github +src_repo: es-shims/String.prototype.trim +tag_prefix: "^v" +seperator: "." diff --git a/string.prototype.trim-1.1.2.tgz b/string.prototype.trim-1.1.2.tgz new file mode 100644 index 0000000..0457d6c Binary files /dev/null and b/string.prototype.trim-1.1.2.tgz differ