1
0
Fork 0

feat(core): Added support for renderProps in defs

This commit is contained in:
joostdecock 2023-06-04 16:44:38 +02:00
parent 53e72d148c
commit 982b3984b8

View file

@ -91,3 +91,15 @@ Defs.prototype.setIfUnset = function (name, value) {
if (typeof this.list[name] === 'undefined') this.list[name] = value
return this
}
/**
* Returns defs as an object suitable for inclusion in renderprops
*
* @return {object} defs - A plain object representing the defs
*/
Defs.prototype.asRenderProps = function () {
return {
list: this.list,
forSvg: this.render(),
}
}