mirror of
https://github.com/appium/appium.git
synced 2026-02-20 18:30:11 -06:00
feat(support): remove unleakString as no usage (#20221)
BREAKING CHANGE: Remove unleakString since it is now in appium/logger
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user