Package: node-tape / 4.9.1-1

0003-Remove-depends-to-trim.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From a734998d5a4b59cbccc86de5fcf86cfb3003ab78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bastien@gmail.com>
Date: Mon, 3 Apr 2017 22:28:45 +0200
Subject: Remove depends to trim

Use directly replacement code. Avoid a lot of depends

Forwarded: no
---
 lib/test.js  | 13 ++++++++++++-
 package.json |  1 -
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/lib/test.js b/lib/test.js
index f8b7f5c..748e867 100644
--- a/lib/test.js
+++ b/lib/test.js
@@ -3,13 +3,24 @@ var defined = require('defined');
 var path = require('path');
 var inherits = require('inherits');
 var EventEmitter = require('events').EventEmitter;
-var trim = require('string.prototype.trim');
 var bind = require('function-bind');
 var has = bind.call(Function.call, Object.prototype.hasOwnProperty);
 var forEach = require('lodash.foreach');
 var isEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable);
 var toLowerCase = bind.call(Function.call, String.prototype.toLowerCase);
 
+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]+$/;
+
+if (!String.prototype.trim) {
+    String.prototype.trim = function () {
+    var S = toString(CheckObjectCoercible(this));
+    return replace(replace(S, leftWhitespace, ''), rightWhitespace, '');
+    };
+}
+var trim = bind.call(Function.call, String.prototype.trim);
+
+
 module.exports = Test;
 
 var nextTick = typeof setImmediate !== 'undefined'
diff --git a/package.json b/package.json
index 543fcaf..b56721d 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,6 @@
         "object-inspect": "~1.6.0",
         "resolve": "~1.7.1",
         "resumer": "~0.0.0",
-        "string.prototype.trim": "~1.1.2",
         "through": "~2.3.8"
     },
     "devDependencies": {