* Returns object representation of a shadow * @return {Object} Object representation of a shadow instance
()
| 224 | * @return {Object} Object representation of a shadow instance |
| 225 | */ |
| 226 | toObject() { |
| 227 | const data: SerializedShadowOptions = { |
| 228 | color: this.color, |
| 229 | blur: this.blur, |
| 230 | offsetX: this.offsetX, |
| 231 | offsetY: this.offsetY, |
| 232 | affectStroke: this.affectStroke, |
| 233 | nonScaling: this.nonScaling, |
| 234 | type: (this.constructor as typeof Shadow).type, |
| 235 | }; |
| 236 | const defaults = Shadow.ownDefaults as SerializedShadowOptions; |
| 237 | return !this.includeDefaultValues |
| 238 | ? pickBy(data, (value, key) => value !== defaults[key]) |
| 239 | : data; |
| 240 | } |
| 241 | |
| 242 | static async fromObject(options: Partial<TClassProperties<Shadow>>) { |
| 243 | return new this(options); |
no test coverage detected