Repository: char0n/ramda-adjunct
Pull request #1137 (2019-10-22 11:14:55)

Update terser-webpack-plugin to the latest version 🚀

## The devDependency [terser-webpack-plugin](https://github.com/webpack-contrib/terser-webpack-plugin) was updated from `2.1.3` to `2.2.0`.
This version is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

---

**Publisher:** [evilebottnawi](https://www.npmjs.com/~evilebottnawi)
**License:** MIT

<details>
<summary>Release Notes for v2.2.0</summary>

<h2><a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/compare/v2.1.3...v2.2.0">2.2.0</a> (2019-10-22)</h2>
<h3>Features</h3>
<ul>
<li>map <code>webpack@5</code> options to <code>terser</code> options (<a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/issues/177" data-hovercard-type="pull_request" data-hovercard-url="/webpack-contrib/terser-webpack-plugin/pull/177/hovercard">#177</a>) (<a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/commit/f4c47aa0e3de27bbab3ae0a90a461841bbce5988">f4c47aa</a>)</li>
<li>pass an asset path for the <code>warningsFilter</code> option (<a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/issues/176" data-hovercard-type="pull_request" data-hovercard-url="/webpack-contrib/terser-webpack-plugin/pull/176/hovercard">#176</a>) (<a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/commit/9a0a575585be21118cb4e3611d30e665a6337c3d">9a0a575</a>)</li>
<li>propagate an error stacktrace from <code>terser</code> (<a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/issues/179" data-hovercard-type="pull_request" data-hovercard-url="/webpack-contrib/terser-webpack-plugin/pull/179/hovercard">#179</a>) (<a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/commit/a11e66b17ae2bb146ded4e64c948d5eece834378">a11e66b</a>)</li>
<li>enable the <code>sourceMap</code> option when the <code>SourceMapDevToolPlugin</code> plugin used (non cheap) (<a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/issues/178" data-hovercard-type="pull_request" data-hovercard-url="/webpack-contrib/terser-webpack-plugin/pull/178/hovercard">#178</a>) (<a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/commit/d01c1b5fef7f0593c91c1be3d4eb36220c3f465d">d01c1b5</a>)</li>
</ul>
<h3>Bug Fixes</h3>
<ul>
<li>get rid deprecation warnings for <code>webpack@5</code> (<a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/issues/180" data-hovercard-type="pull_request" data-hovercard-url="/webpack-contrib/terser-webpack-plugin/pull/180/hovercard">#180</a>) (<a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/commit/504ea8b2017e6fa9b8a5f2123025ee5b7b4d80b1">504ea8b</a>)</li>
</ul>
</details>

<details>
<summary>Commits</summary>
<p>The new version differs by 6 commits.</p>
<ul>
<li><a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/commit/cd802272973959493473d6e67412760113a27a29"><code>cd80227</code></a> <code>chore(release): 2.2.0</code></li>
<li><a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/commit/504ea8b2017e6fa9b8a5f2123025ee5b7b4d80b1"><code>504ea8b</code></a> <code>fix: get rid deprecation warnings for <code>webpack@5</code> (#180)</code></li>
<li><a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/commit/a11e66b17ae2bb146ded4e64c948d5eece834378"><code>a11e66b</code></a> <code>feat: propagate an error stacktrace from <code>terser</code> (#179)</code></li>
<li><a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/commit/d01c1b5fef7f0593c91c1be3d4eb36220c3f465d"><code>d01c1b5</code></a> <code>feat: respect <code>SourceMapDevToolPlugin</code> plugin for <code>sourceMap</code> option (#178)</code></li>
<li><a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/commit/f4c47aa0e3de27bbab3ae0a90a461841bbce5988"><code>f4c47aa</code></a> <code>feat: map <code>webpack@5</code> options to <code>terser</code> options (#177)</code></li>
<li><a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/commit/9a0a575585be21118cb4e3611d30e665a6337c3d"><code>9a0a575</code></a> <code>feat: pass asset path for warningsFilter (#176)</code></li>
</ul>
<p>See the <a href="https://urls.greenkeeper.io/webpack-contrib/terser-webpack-plugin/compare/92c56add39df84863eeca68382b984a3cbecf0c4...cd802272973959493473d6e67412760113a27a29">full diff</a></p>
</details>

---

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot :palm_tree:




Patch:
diff --git a/package-lock.json b/package-lock.json
index 413b2efdb7..a5b79626be 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -12186,18 +12186,18 @@
       }
     },
     "terser-webpack-plugin": {
-      "version": "2.1.3",
-      "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.1.3.tgz",
-      "integrity": "sha512-z5Utx0TxmirZvRNL1GC795tlDM+bO83ZfcbtkL1y1VLoWtZ7S2a9+HFCLnabSRE/Yjsu4zCEX6U6CIRo4dVmcQ==",
+      "version": "2.2.0",
+      "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-2.2.0.tgz",
+      "integrity": "sha512-Sv2tyWCEXSi7aHCBOnigWMIFYHScftKytogG08RCmusPRkYMRCxyq2rVdy7s1ahEE13Yoz2ddgPsNU6axP5LJg==",
       "dev": true,
       "requires": {
         "cacache": "^13.0.1",
         "find-cache-dir": "^3.0.0",
         "jest-worker": "^24.9.0",
-        "schema-utils": "^2.4.1",
+        "schema-utils": "^2.5.0",
         "serialize-javascript": "^2.1.0",
         "source-map": "^0.6.1",
-        "terser": "^4.3.8",
+        "terser": "^4.3.9",
         "webpack-sources": "^1.4.3"
       },
       "dependencies": {
@@ -12239,12 +12239,6 @@
             "unique-filename": "^1.1.1"
           }
         },
-        "commander": {
-          "version": "2.20.1",
-          "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.1.tgz",
-          "integrity": "sha512-cCuLsMhJeWQ/ZpsFTbE765kvVfoeSddc4nU3up4fV+fDBcfUXnbITJ+JzhkdjzOqhURjZgujxaioam4RM9yGUg==",
-          "dev": true
-        },
         "find-cache-dir": {
           "version": "3.0.0",
           "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.0.0.tgz",
@@ -12339,9 +12333,9 @@
           }
         },
         "schema-utils": {
-          "version": "2.4.1",
-          "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.4.1.tgz",
-          "integrity": "sha512-RqYLpkPZX5Oc3fw/kHHHyP56fg5Y+XBpIpV8nCg0znIALfq3OH+Ea9Hfeac9BAMwG5IICltiZ0vxFvJQONfA5w==",
+          "version": "2.5.0",
+          "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-2.5.0.tgz",
+          "integrity": "sha512-32ISrwW2scPXHUSusP8qMg5dLUawKkyV+/qIEV9JdXKx+rsM6mi8vZY8khg2M69Qom16rtroWXD3Ybtiws38gQ==",
           "dev": true,
           "requires": {
             "ajv": "^6.10.2",
@@ -12370,17 +12364,6 @@
             "minipass": "^3.0.0"
           }
         },
-        "terser": {
-          "version": "4.3.8",
-          "resolved": "https://registry.npmjs.org/terser/-/terser-4.3.8.tgz",
-          "integrity": "sha512-otmIRlRVmLChAWsnSFNO0Bfk6YySuBp6G9qrHiJwlLDd4mxe2ta4sjI7TzIR+W1nBMjilzrMcPOz9pSusgx3hQ==",
-          "dev": true,
-          "requires": {
-            "commander": "^2.20.0",
-            "source-map": "~0.6.1",
-            "source-map-support": "~0.5.12"
-          }
-        },
         "yallist": {
           "version": "4.0.0",
           "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
diff --git a/package.json b/package.json
index 73bbd026f4..d8f95eed07 100644
--- a/package.json
+++ b/package.json
@@ -173,7 +173,7 @@
     "rimraf": "3.0.0",
     "sanctuary-show": "=1.0.0",
     "sinon": "=7.5.0",
-    "terser-webpack-plugin": "2.1.3",
+    "terser-webpack-plugin": "2.2.0",
     "testem": "3.0.0",
     "tslint": "=5.14.0",
     "typescript": "=3.5.3",
diff --git a/src/index.js b/src/index.js
index a4a4f5b15d..238ced776b 100644
--- a/src/index.js
+++ b/src/index.js
@@ -196,6 +196,8 @@ export { default as replaceAll } from './replaceAll';
 export { default as escapeRegExp } from './escapeRegExp';
 export { default as trimStart } from './trimStart';
 export { default as trimLeft } from './trimStart'; // alias of trimStart
+export { default as trimEnd } from './trimEnd';
+export { default as trimRight } from './trimEnd'; // alias of trimEnd
 export { default as padCharsEnd } from './padCharsEnd';
 // Types
 export { default as Identity } from './fantasy-land/Identity';
diff --git a/src/internal/polyfills/String.trimEnd.js b/src/internal/polyfills/String.trimEnd.js
new file mode 100644
index 0000000000..4c5e20b90d
--- /dev/null
+++ b/src/internal/polyfills/String.trimEnd.js
@@ -0,0 +1,5 @@
+import { replace } from 'ramda';
+
+const trimStart = replace(/\s+$/, '');
+
+export default trimStart;
diff --git a/src/trimEnd.js b/src/trimEnd.js
new file mode 100644
index 0000000000..7d3ebb4d3f
--- /dev/null
+++ b/src/trimEnd.js
@@ -0,0 +1,30 @@
+import { invoker } from 'ramda';
+
+import polyfill from './internal/polyfills/String.trimEnd';
+import isFunction from './isFunction';
+
+export const trimEndPolyfill = polyfill;
+
+export const trimEndInvoker = invoker(0, 'trimEnd');
+
+/**
+ * Removes whitespace from the end of a string.
+ *
+ * @func trimEnd
+ * @memberOf RA
+ * @since {@link https://char0n.github.io/ramda-adjunct/2.22.0|v2.22.0}
+ * @category String
+ * @sig String -> String
+ * @param {string} value String value to have the whitespace removed from the end
+ * @return {string} A new string representing the calling string stripped of whitespace from its end (right end).
+ * @see {@link RA.trimEnd|trimEnd}
+ * @example
+ *
+ * RA.trimEnd('abc   '); //=> 'abc'
+ */
+
+const trimEnd = isFunction(String.prototype.trimEnd)
+  ? trimEndInvoker
+  : trimEndPolyfill;
+
+export default trimEnd;
diff --git a/types/index.d.ts b/types/index.d.ts
index 1d6c7429e3..dcc3de9743 100644
--- a/types/index.d.ts
+++ b/types/index.d.ts
@@ -1254,7 +1254,13 @@ declare namespace RamdaAdjunct {
         trimStart(value: string): string;
         trimLeft(value: string): string;
 
-        /*
+        /**
+         * Removes whitespace from the end of a string.
+         */
+        trimEnd(value: string): string;
+        trimRight(value: string): string;
+
+        /**
          * The function pads the current string with a given string
          * (repeated, if needed) so that the resulting string reaches a given length.
          * The padding is applied from the end of the current string.


Test patch:
diff --git a/test/trimEnd.js b/test/trimEnd.js
new file mode 100644
index 0000000000..17d8466294
--- /dev/null
+++ b/test/trimEnd.js
@@ -0,0 +1,110 @@
+import * as R from 'ramda';
+
+import * as RA from '../src';
+import { trimEndInvoker, trimEndPolyfill } from '../src/trimEnd';
+import eq from './shared/eq';
+
+describe('trimEnd', function() {
+  specify('should remove whitespace from the end of a string', function() {
+    eq(RA.trimEnd('abc   '), 'abc');
+  });
+
+  specify(
+    'should not remove whitespace from the rest of the string',
+    function() {
+      eq(RA.trimEnd(' a b c'), ' a b c');
+    }
+  );
+
+  context('given an empty string', function() {
+    specify('should return an empty string', function() {
+      eq(RA.trimEnd(''), '');
+    });
+  });
+
+  context('given an string with whitespaces only', function() {
+    specify('should return an empty string', function() {
+      eq(RA.trimEnd('   '), '');
+    });
+  });
+
+  specify('should support placeholder to specify "gaps"', function() {
+    const trimEnd = RA.trimEnd(R.__);
+
+    eq(trimEnd('abc   '), 'abc');
+  });
+
+  context('trimEndInvoker', function() {
+    beforeEach(function() {
+      if (RA.isNotFunction(String.prototype.trimEnd)) {
+        this.skip();
+      }
+    });
+
+    specify('should remove whitespace from the end of a string', function() {
+      eq(trimEndInvoker('abc   '), 'abc');
+    });
+
+    specify(
+      'should not remove whitespace from the rest of the string',
+      function() {
+        eq(trimEndInvoker(' a b c'), ' a b c');
+      }
+    );
+
+    context('given an empty string', function() {
+      specify('should return an empty string', function() {
+        eq(trimEndInvoker(''), '');
+      });
+    });
+
+    context('given an string with whitespaces only', function() {
+      specify('should return an empty string', function() {
+        eq(trimEndInvoker('   '), '');
+      });
+    });
+
+    specify('should support placeholder to specify "gaps"', function() {
+      const trimEnd = trimEndInvoker(R.__);
+
+      eq(trimEnd('abc   '), 'abc');
+    });
+  });
+
+  context('trimEndPolyfill', function() {
+    specify('should remove whitespace from the end of a string', function() {
+      eq(trimEndPolyfill('abc   '), 'abc');
+    });
+
+    specify(
+      'should not remove whitespace from the rest of the string',
+      function() {
+        eq(trimEndPolyfill(' a b c'), ' a b c');
+      }
+    );
+
+    context('given an empty string', function() {
+      specify('should return an empty string', function() {
+        eq(trimEndPolyfill(''), '');
+      });
+    });
+
+    context('given an string with whitespaces only', function() {
+      specify('should return an empty string', function() {
+        eq(trimEndPolyfill('   '), '');
+      });
+    });
+
+    specify('should support placeholder to specify "gaps"', function() {
+      const trimEnd = trimEndPolyfill(R.__);
+
+      eq(trimEnd('abc   '), 'abc');
+    });
+  });
+});
+
+describe('trimRight', function() {
+  it('should be alias of trimEnd', function() {
+    eq(RA.trimRight === RA.trimEnd, true);
+  });
+});
diff --git a/types/test/trimEnd.ts b/types/test/trimEnd.ts
new file mode 100644
index 0000000000..ac20f41ad0
--- /dev/null
+++ b/types/test/trimEnd.ts
@@ -0,0 +1,20 @@
+import * as RA from 'ramda-adjunct';
+
+RA.trimEnd('abc'); // $ExpectType string
+RA.trimEnd(''); // $ExpectType string
+
+RA.trimEnd(1); // $ExpectError
+RA.trimEnd({}); // $ExpectError
+RA.trimEnd(null); // $ExpectError
+RA.trimEnd(undefined); // $ExpectError
+RA.trimEnd([]); // $ExpectError
+
+// alias
+RA.trimRight('abc'); // $ExpectType string
+RA.trimRight(''); // $ExpectType string
+
+RA.trimRight(1); // $ExpectError
+RA.trimRight({}); // $ExpectError
+RA.trimRight(null); // $ExpectError
+RA.trimRight(undefined); // $ExpectError
+RA.trimRight([]); // $ExpectError