1
0
Fork 0
freesewing/markdown/dev/reference/api/attributes/aspropsifprefixis/en.md
2022-12-14 12:52:37 -08:00

527 B

title
Attributes.asPropsIfPrefixIs()

The Attributes.asPropsIfPrefixIs() method will return attribute values as a props object (a plain JavaScript object) but only for those keys who start with prefix.

Signature

Object attributes.asPropsIfPrefixIs(string prefix)

Example

const attr = new Attributes()
  .add('class', 'various')
  .add('stroke', 'red')
  .add('stroke-width', 2)

const props = attr.asPropsIfPrefixIs('stroke')
/* Props holds:
{
  stroke: 'red',
  stroke-width: 2
}
*/