@small-tech/attribute-parser
v1.0.2
Published
Parses the attributes in a string containing a single tag.
Downloads
3
Maintainers
Readme
@small-tech/attribute-parser
Parses the attributes in a string containing a single tag.
Install
npm install @small-tech/attribute-parser
Use
import parseAttributes from '@small-tech/attribute-parser'
const tag = `
<tag
booleanAttribute
unquotedAttribute=value1
singleQuotesAttribute='value2'
doubleQuotedAttribute="value3"
attribute-with-dashes='value4'
>…</tag>
`
parseAttributes (tag)
Returns:
{
booleanAttribute: true,
unquotedAttribute: 'value1',
singleQuotedAttribute: 'value2',
doubleQuotedAttribute: 'value3',
attributeWithDashes: 'value4'
}
Like this? Fund us!
Small Technology Foundation is a tiny, independent not-for-profit.
We exist in part thanks to patronage by people like you. If you share our vision and want to support our work, please become a patron or donate to us today and help us continue to exist.
Copyright & license
Copyright © 2023-present, Aral Balkan, Small Technology Foundation. Released under AGPL version 3.0.