Permalink
Browse files

Remove unnecessary String.trim shim

  • Loading branch information...
1 parent c7d2a92 commit 3e8e3b693351b36058bc886472c9c2b02deeffe2 @brycekahle brycekahle committed Jan 23, 2017
Showing with 1 addition and 21 deletions.
  1. +1 −0 Changelog.md
  2. +0 −21 lib/shims.js
View
@@ -9,6 +9,7 @@
* Simplify build setup
* Update to Node.js 6.9
* Add sourcemap for minified version
+ * Remove unused String.trim shim
1.1.1
==
View
@@ -434,27 +434,6 @@ if (
};
}
-// ES5 15.5.4.20
-// whitespace from: http://es5.github.io/#x15.5.4.20
-var ws = '\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 zeroWidth = '\u200b';
-var wsRegexChars = '[' + ws + ']';
-var trimBeginRegexp = new RegExp('^' + wsRegexChars + wsRegexChars + '*');
-var trimEndRegexp = new RegExp(wsRegexChars + wsRegexChars + '*$');
-var hasTrimWhitespaceBug = StringPrototype.trim && (ws.trim() || !zeroWidth.trim());
-defineProperties(StringPrototype, {
- // http://blog.stevenlevithan.com/archives/faster-trim-javascript
- // http://perfectionkills.com/whitespace-deviations/
- trim: function trim() {
- if (this === void 0 || this === null) {
- throw new TypeError("can't convert " + this + ' to object');
- }
- return String(this).replace(trimBeginRegexp, '').replace(trimEndRegexp, '');
- }
-}, hasTrimWhitespaceBug);
-
// ECMA-262, 3rd B.2.3
// Not an ECMAScript standard, although ECMAScript 3rd Edition has a
// non-normative section suggesting uniform semantics and it should be

0 comments on commit 3e8e3b6

Please sign in to comment.