-
Notifications
You must be signed in to change notification settings - Fork 0
Drop some lodash usage in favor of native JS alternatives #251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Change-type: patch
|
Website deployed to CF Pages, 👀 preview link https://2da9b555.balena-design-system.pages.dev |
08973d1 to
2262746
Compare
| const InstructionsItem = ({ node, index }: InstructionsItemProps) => { | ||
| const hasChildren = has(node, 'children'); | ||
| const hasChildren = | ||
| node != null && Object.hasOwnProperty.call(node, 'children'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine to just use Object.hasOwn as it is supported by all browsers we support ATM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not supported by our current module
|
|
||
| const getKeyLabel = (schema: JSONSchema) => { | ||
| const s = find(schema.properties, { description: 'key' }) as JSONSchema; | ||
| const s = findValueByDescription(schema.properties, 'key'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can remove these 2 find methods and reuse
| export const findInObject = (obj: Record<string, any>, key: string): any => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please explain why you think so? They do not appear alike to me
Change-type: patch
2262746 to
2a30881
Compare
Fibery: https://balena.fibery.io/Work/Project/We-should-migrate-from-lodash-to-es-toolkit-(UI-CLI-etc.)-1895