Skip to content

Commit

Permalink
Move implementation to implementation.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Aug 16, 2015
1 parent de4cd87 commit e455b2a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
13 changes: 13 additions & 0 deletions implementation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

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]+$/;

module.exports = function trim() {
var S = ES.ToString(ES.CheckObjectCoercible(this));
return replace(replace(S, leftWhitespace, ''), rightWhitespace, '');
};
10 changes: 1 addition & 9 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
'use strict';

var bind = require('function-bind');
var ES = require('es-abstract/es5');
var define = require('define-properties');
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 trim = function trim() {
var S = ES.ToString(ES.CheckObjectCoercible(this));
return replace(replace(S, leftWhitespace, ''), rightWhitespace, '');
};
var trim = require('./implementation');

var boundTrim = bind.call(Function.call, trim);
define(boundTrim, {
Expand Down

0 comments on commit e455b2a

Please sign in to comment.