From 0691fddb3fdb08ec2397432653278ac720daf516 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=20=E9=8A=8D?= Date: Mon, 9 Dec 2024 21:47:39 +0800 Subject: [PATCH] feat(feel): Add new built-in function (#4713) Add new built-in function of the FEEL engine to the FEEL documentation. --- .../feel-built-in-functions-list.md | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-list.md b/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-list.md index 9f6b2358e5a..63e8c984897 100644 --- a/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-list.md +++ b/docs/components/modeler/feel/builtin-functions/feel-built-in-functions-list.md @@ -621,3 +621,30 @@ is empty([]) is empty([1,2,3]) // false ``` + +## partition(list, size) + + + +Returns consecutive sublists of a list, each of the same size (the final list may be smaller). + +If `size` is less than `0`, it returns `null`. + +**Function signature** + +```feel +partition(list: list, size: number): list +``` + +**Examples** + +```feel +partition([1,2,3,4,5], 2) +// [[1,2], [3,4], [5]] + +partition([], 2) +// [] + +partition([1,2], 0) +// null +```