-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: warframe-items build refactor to esm
- Loading branch information
Showing
31 changed files
with
292 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
extends: '@wfcd/eslint-config/esm' | ||
parserOptions: | ||
babelOptions: | ||
plugins: | ||
- '@babel/plugin-syntax-import-assertions' | ||
rules: | ||
no-console: off | ||
import/no-extraneous-dependencies: off | ||
import/extensions: | ||
- error | ||
- always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
'use strict'; | ||
|
||
const objectsort = require('./objectsort'); | ||
import { sortObject } from './sortObject.mjs'; | ||
|
||
/** | ||
* Simple deduplication leveraging reduce (and equality based on stringification) | ||
* @param {Iterable<*>} iter Should be an iterable object, but function will check first. | ||
* @returns {Iterable<*>} type will be whatever was originally passed in | ||
*/ | ||
module.exports = (iter) => { | ||
export function dedupe(iter) { | ||
return Array.isArray(iter) | ||
? iter | ||
.reduce( | ||
(acc, curr) => | ||
(!acc.includes(JSON.stringify(objectsort(curr))) && acc.push(JSON.stringify(objectsort(curr))) && acc) || | ||
(!acc.includes(JSON.stringify(sortObject(curr))) && acc.push(JSON.stringify(sortObject(curr))) && acc) || | ||
acc, | ||
[] | ||
) | ||
.map((o) => JSON.parse(o)) | ||
: iter; | ||
}; | ||
} | ||
|
||
export default dedupe; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.