From 352e9d6476b0224491e8fd07dce58ee536e157df Mon Sep 17 00:00:00 2001 From: Jelle De Loecker Date: Mon, 11 Mar 2024 12:35:52 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Make=20`Function.getDescendant(name?= =?UTF-8?q?)`=20also=20try=20the=20lowercase=20version=20of=20the=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + lib/function_inheritance.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 241cbf7..25fcec0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 0.9.3 (WIP) * Add `Trail#ifNull(fallback)` method +* Make `Function.getDescendant(name)` also try the lowercase version of the name ## 0.9.2 (2024-02-25) diff --git a/lib/function_inheritance.js b/lib/function_inheritance.js index dcaf716..9ea3393 100644 --- a/lib/function_inheritance.js +++ b/lib/function_inheritance.js @@ -1075,7 +1075,7 @@ defClassMethod(function getDescendantsDict(constructor) { * * @author Jelle De Loecker * @since 0.7.26 - * @version 0.9.0 + * @version 0.9.3 */ defClassMethod(function getDescendant(constructor, name) { @@ -1085,7 +1085,7 @@ defClassMethod(function getDescendant(constructor, name) { const dict = constructor.getDescendantsDict(); - let result = dict[name]; + let result = dict[name] || dict[name.toLowerCase()]; if (!result) { name = Blast.parseClassPath(name).map(entry => Bound.String.underscore(entry)).join('.');