From 745fdaafa4e261745ebe2d82547321f68644f735 Mon Sep 17 00:00:00 2001 From: Fenris Wolf Date: Thu, 23 Oct 2025 13:19:39 +0200 Subject: [PATCH] [task-416] --- lib/plankton/plankton.d.ts | 3 +++ lib/plankton/plankton.js | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/plankton/plankton.d.ts b/lib/plankton/plankton.d.ts index 30c6b9f..9da3c53 100644 --- a/lib/plankton/plankton.d.ts +++ b/lib/plankton/plankton.d.ts @@ -882,6 +882,9 @@ declare namespace lib_plankton.call { /** */ export function sleep(seconds: float): Promise; + /** + */ + export function null_prop(value_from: (null | type_value_from), function_: ((value: type_value_from) => type_value_to)): (null | type_value_to); export {}; } declare namespace lib_plankton.file { diff --git a/lib/plankton/plankton.js b/lib/plankton/plankton.js index 8509b96..6a8b172 100644 --- a/lib/plankton/plankton.js +++ b/lib/plankton/plankton.js @@ -2043,6 +2043,16 @@ var lib_plankton; })); } call.sleep = sleep; + /** + */ + function null_prop(value_from, function_) { + return ((value_from === null) + ? + null + : + function_(value_from)); + } + call.null_prop = null_prop; })(call = lib_plankton.call || (lib_plankton.call = {})); })(lib_plankton || (lib_plankton = {})); /* @@ -3792,10 +3802,10 @@ var lib_plankton; options = Object.assign({ "compare_value": instance_compare }, options); - if (is_empty(list)) { + /*if (is_empty(list)) { throw (new Error("the max-arg of an empty list is not defined")); } - else { + else */ { return (list .reduce(function (result, element, index) { var value = target_function(element);