Go to main content

flat

Flatten an array

FLAT

NAME

flat - Flatten an array

SYNOPSIS

flat(expression, ...)

DESCRIPTION

This function is used to flatten an array.

The function return a flat array with all the expression in the array.

This is available in version 5.165.

EXAMPLES

Example 1:
    flat(1,2,[12],{ "x" : [1,2], "y" : { "a" : 1.2, "b" : true } }); 

    // return [1,2,12,{"x":[1,2]},{"y":{"a":1.2,"b":true}}]

Example 2:
    a = [ 1, null, undefined, [1, "2", 3.14], { "x" : [1,2], "y" : { "a" : 1.2, "b" : true } }];
    flat(a);

    // return [1,null,null,1,"2",3.14,{"x":[1,2]},{"y":{"a":1.2,"b":true}}]

SEE ALSO

{{ include("includes/array.sn") }}

AUTHOR

Written by Pierre Laplante and Caroline Laplante, <laplante@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.