From 75b8c2019550550340d6714ae97e91534e1f34d2 Mon Sep 17 00:00:00 2001 From: ghaiklor Date: Thu, 12 Nov 2015 10:39:22 +0200 Subject: [PATCH] feat(shape): Implements static method that creates new instances of shapes --- src/Shape.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Shape.js b/src/Shape.js index 45315e2..e538abe 100644 --- a/src/Shape.js +++ b/src/Shape.js @@ -137,4 +137,13 @@ export class Shape { // TODO: Make sure that it's correct throw new Error('render() method must be implemented'); } + + /** + * Create new shape instance + * @param {*} args + * @returns {Shape} + */ + static create(...args) { + return new this(...args); + } }