From 2665605510452df7308b4c4b08206585fc97f223 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 11 Jul 2024 15:02:19 -0700 Subject: [PATCH] [Refactor] remove `string.prototype.trim` --- index.js | 3 +-- package.json | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/index.js b/index.js index 6d86a2a..3fc7524 100644 --- a/index.js +++ b/index.js @@ -21,7 +21,6 @@ var forEach = require('array.prototype.foreach'); var entries = require('object.entries'); var warning = require('warning'); var has = require('hasown'); -var trim = require('string.prototype.trim'); var warn = function warn(message) { warning(false, message); @@ -242,7 +241,7 @@ function transformPhrase( options.smart_count ); - result = trim(texts[pluralTypeWithCount] || texts[0]); + result = defaultReplace.call(texts[pluralTypeWithCount] || texts[0], /^[^\S]*|[^\S]*$/g, ''); } // Interpolate: Creates a `RegExp` object for each interpolation placeholder. diff --git a/package.json b/package.json index ea99fbf..9d110d1 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,6 @@ "array.prototype.foreach": "^1.0.7", "hasown": "^2.0.2", "object.entries": "^1.1.8", - "string.prototype.trim": "^1.2.9", "warning": "^4.0.3" }, "devDependencies": {