Installation
Quick Take
Purpose
- If it’s a non-empty string, put it into an array and return it.
- If it’s an empty string, return an empty array.
- If it’s anything else, just return it.
...including proper typings.
It’s main purpose is to prepare the input argument options’ objects.
API — arrayiffy()
The main function arrayiffy()
is imported like this:
It is a function which takes one input argument:
Competition
Mr. Sorhus’ arrify
API is slightly different, it casts everything to array (null
into empty array, for example). arrayiffy-if-string
on other hand, wraps only strings into arrays, bypassing the rest (null
into null
, for example).
It depends what you need.