feat(support): remove unleakString as no usage (#20221)

BREAKING CHANGE: Remove unleakString since it is now in appium/logger
This commit is contained in:
Kazuaki Matsuo
2024-06-07 17:57:13 -07:00
committed by GitHub
parent 0363aab8ba
commit 93c271ec5d
2 changed files with 0 additions and 27 deletions

View File

@@ -358,18 +358,6 @@ function quote(args) {
return shellQuote(_.castArray(args));
}
/**
* This function is necessary to workaround unexpected memory leaks
* caused by NodeJS string interning
* behavior described in https://bugs.chromium.org/p/v8/issues/detail?id=2869
*
* @param {any} s - The string to unleak
* @return {string} Either the unleaked string or the original object converted to string
*/
function unleakString(s) {
return ` ${s}`.substring(1);
}
/**
* @typedef PluralizeOptions
* @property {boolean} [inclusive=false] - Whether to prefix with the number (e.g., 3 ducks)
@@ -555,7 +543,6 @@ export {
compareVersions,
coerceVersion,
quote,
unleakString,
jsonStringify,
pluralize,
GiB,

View File

@@ -503,20 +503,6 @@ describe('util', function () {
});
});
describe('unleakString', function () {
it('should unleak a string', function () {
util.unleakString('yolo').should.eql('yolo');
});
it('should unleak a multiline string', function () {
util.unleakString(' yolo\nbolo ').should.eql(' yolo\nbolo ');
});
it('should convert an object to a string', function () {
for (const obj of [{}, null, undefined, [], 0]) {
util.unleakString(obj).should.eql(`${obj}`);
}
});
});
describe('pluralize', function () {
/*
* The pluralize library (https://github.com/blakeembrey/pluralize)