From aa65dc1e54a9a76ffce32d278c7f8f25e9782c02 Mon Sep 17 00:00:00 2001 From: chris Date: Mon, 12 May 2025 11:21:13 +0200 Subject: [PATCH] FIX,IMPRO,REFA: overriding all function for border --- src/decorators/border.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/decorators/border.js b/src/decorators/border.js index 37bf05d..bfe50eb 100644 --- a/src/decorators/border.js +++ b/src/decorators/border.js @@ -200,6 +200,30 @@ class Border extends Sides { ] }); } + + + /** + * If the given amount is a number this method calls width(amount). + * If amount is instanceof BorderDefinition it will set the BorderDefinition + * to all sides. + * If neither it will do nothing and return this Border object. + * + * @inheritdoc + * @override + * @param {number|BorderDefinition} amount value to set for all directions + * @returns {typeof Sides} this + */ + all(amount) { + if(amount instanceof Number){ + return this.width(amount); + } + + if(amount instanceof BorderDefinition){ + return super.all(amount); + } + + return this; + } } /**