diff options
| author | Kris <[email protected]> | 2022-06-10 05:52:59 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-06-10 12:52:59 +0000 |
| commit | e466347c4d76a7e7ab8c42df983aea2f2b58acf0 (patch) | |
| tree | 07c2f60fe2ba088439935feca7ffe350076f5946 /src/modules | |
| parent | 26f89ea6013cda78fbd615fe7e44eedea2514b48 (diff) | |
| download | faker-e466347c4d76a7e7ab8c42df983aea2f2b58acf0.tar.xz faker-e466347c4d76a7e7ab8c42df983aea2f2b58acf0.zip | |
chore: replace setToArray() with Array.from (#1050)
Diffstat (limited to 'src/modules')
| -rw-r--r-- | src/modules/system/index.ts | 24 |
1 files changed, 2 insertions, 22 deletions
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 @@ -15,25 +15,6 @@ const commonMimeTypes = [ ]; /** - * 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<T>(set: Set<T>): 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. */ export class System { @@ -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); } |
