repo
replacements.fyi

// package

array-ify

type: "module"

// preferences

// replacements (1)

snippet::array-coerce

Simple or drop-in replacement

This package is no longer necessary. You can use a combination of a ternary operator and `Array.isArray` to make sure a value, `undefined`, `null` or an array is always returned as an array.

// example

val == null
	? []
	: Array.isArray(val)
		? val
		: [val];
// Or if you need to convert an iterable into an array
Array.from(iterable);