Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

feat(core): dereference elements with valueOf #561

Merged
merged 5 commits into from
Sep 23, 2020

Conversation

patricksmms
Copy link
Contributor

No description provided.

@patricksmms patricksmms force-pushed the patricksmms/improve-define-value-of branch from 94a81b6 to 63c5a14 Compare September 17, 2020 10:17
@patricksmms patricksmms force-pushed the patricksmms/improve-define-value-of branch from 63c5a14 to 7764adf Compare September 17, 2020 11:34
* Get element attribute
* @param {element} e - element - element
* @param {string} attribute
* @return {boolean}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this isn't true, getAttribute would return Element (member value) or undefined.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed on cdeebcf

*/
const isOptional = e => hasTypeAttribute(e, 'optional');

const baseTypes = new Set(['boolean', 'string', 'number', 'array', 'object', 'enum']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this include null?

There's also other refract base types:member, select, option, extend, ref and link (https://apielements.org/en/latest/element-definitions.html#data-structure-element-types) elements. Although perhaps for purposes of check you don't want those.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense to add them all to the list.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed on add7f25

patricksmms added a commit that referenced this pull request Sep 18, 2020
@patricksmms patricksmms force-pushed the patricksmms/improve-define-value-of branch from ea823ff to 60121f0 Compare September 23, 2020 15:32
@patricksmms patricksmms merged commit fdb70bf into master Sep 23, 2020
@patricksmms patricksmms deleted the patricksmms/improve-define-value-of branch September 23, 2020 15:38
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants