Skip to content

Optional Attributes returning wrong Type #6

@therealmitchconnors

Description

@therealmitchconnors

When an optional attribute is omitted from an xml document, attempting to retrieve the attribute value should return undefined or null, but instead returns an untyped object with _exist: false. This means that null checks against these optional attributes pass, even when they are not specified.

For example, at https://github.com/charto/cxml/blob/master/test/dir-example.ts#L50 , if you were to add: let inode = doc.dir.inode || '' the value of inode would be an object with _exists: false, not a string representing the inode of the directory.

Have I missed some handy feature for detecting unspecified optional attributes?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions