Skip to content

Commit 5c940dc

Browse files
committed
refactor: omit object key is not dupe
1 parent a08e498 commit 5c940dc

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

src/pages/factory-classic/item-params.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@ import CustomInput from 'components/custom-input'
2121
import ItemDetailsCard from 'components/item-details-card'
2222
import { ItemTypes as AllItemTypes } from '@kleros/gtcr-encoder'
2323
import { STATUS_CODE } from 'utils/item-status'
24-
25-
const objectWithoutKey = (object, key) => {
26-
// eslint-disable-next-line no-unused-vars
27-
const { [key]: nothing, ...otherKeys } = object
28-
return otherKeys
29-
}
24+
import objectWithoutKey from 'utils/object-without-key'
3025

3126
const ItemTypes = objectWithoutKey(AllItemTypes, 'TWITTER_USER_ID')
3227

src/pages/factory/item-params.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@ import CustomInput from 'components/custom-input'
2121
import ItemDetailsCard from 'components/item-details-card'
2222
import { ItemTypes as AllItemTypes } from '@kleros/gtcr-encoder'
2323
import { STATUS_CODE } from 'utils/item-status'
24-
25-
const objectWithoutKey = (object, key) => {
26-
// eslint-disable-next-line no-unused-vars
27-
const { [key]: nothing, ...otherKeys } = object
28-
return otherKeys
29-
}
24+
import objectWithoutKey from 'utils/object-without-key'
3025

3126
const ItemTypes = objectWithoutKey(AllItemTypes, 'TWITTER_USER_ID')
3227

src/utils/object-without-key.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// i don't want to have to import lodash just for this
2+
3+
const objectWithoutKey = (object, key) => {
4+
// eslint-disable-next-line no-unused-vars
5+
const { [key]: nothing, ...otherKeys } = object
6+
return otherKeys
7+
}
8+
9+
export default objectWithoutKey

0 commit comments

Comments
 (0)