From e466347c4d76a7e7ab8c42df983aea2f2b58acf0 Mon Sep 17 00:00:00 2001 From: Kris Date: Fri, 10 Jun 2022 05:52:59 -0700 Subject: chore: replace setToArray() with Array.from (#1050) --- src/modules/system/index.ts | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) (limited to 'src/modules/system') diff --git a/src/modules/system/index.ts b/src/modules/system/index.ts index 250f1fb8..200deafe 100644 --- a/src/modules/system/index.ts +++ b/src/modules/system/index.ts @@ -14,25 +14,6 @@ const commonMimeTypes = [ 'text/html', ]; -/** - * Converts the given set to an array. - * - * @param set The set to convert. - */ -// TODO ST-DDT 2022-03-11: Replace with Array.from(Set) -function setToArray(set: Set): T[] { - // shortcut if Array.from is available - if (Array.from) { - return Array.from(set); - } - - const array: T[] = []; - set.forEach((item) => { - array.push(item); - }); - return array; -} - /** * Generates fake data for many computer systems properties. */ @@ -121,7 +102,7 @@ export class System { typeSet.add(type); }); - const types = setToArray(typeSet); + const types = Array.from(typeSet); return this.faker.helpers.arrayElement(types); } @@ -151,8 +132,7 @@ export class System { } }); - const extensions = setToArray(extensionSet); - + const extensions = Array.from(extensionSet); return this.faker.helpers.arrayElement(extensions); } -- cgit v1.2.3