Forum Discussion

acesario's avatar
acesario
Contributor II
5 years ago
Solved

Expression using isArray?

Does snaplogic support the use if isArray (or similar function)? We are hitting multiple issues across pipelines where the inbound data is sometimes simply a value and sometimes an array. Would li...
  • del's avatar
    5 years ago

    There are a couple of options, maybe more.

    I use sl.ensureArray quite frequently. It converts the object to an array, if it is not already an array. sl.ensureArray($myObjectOrArray)

    Also available is typeof, which comes in handy in other cases. typeof $myObjectOrArray == "array"