Sha256: 925e3f8702ddeceffb82b05d586dd57579e88fca5203b649c0a6ff1cb0fce91f

Contents?: true

Size: 187 Bytes

Versions: 10

Compression:

Stored size: 187 Bytes

Contents

export default function ensureArray<T>(thing: Array<T> | T | undefined | null): Array<T> {
	if (Array.isArray(thing)) return thing;
	if (thing == undefined) return [];
	return [thing];
}

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
condenser-0.3 lib/condenser/processors/node_modules/rollup-pluginutils/src/utils/ensureArray.ts
condenser-0.2 lib/condenser/processors/node_modules/rollup-pluginutils/src/utils/ensureArray.ts
condenser-0.1 lib/condenser/processors/node_modules/rollup-pluginutils/src/utils/ensureArray.ts
condenser-0.0.12 lib/condenser/processors/node_modules/rollup-pluginutils/src/utils/ensureArray.ts
condenser-0.0.11 lib/condenser/processors/node_modules/rollup-pluginutils/src/utils/ensureArray.ts
condenser-0.0.10 lib/condenser/processors/node_modules/rollup-pluginutils/src/utils/ensureArray.ts
condenser-0.0.9 lib/condenser/processors/node_modules/rollup-pluginutils/src/utils/ensureArray.ts
condenser-0.0.8 lib/condenser/processors/node_modules/rollup-pluginutils/src/utils/ensureArray.ts
condenser-0.0.7 lib/condenser/processors/node_modules/rollup-pluginutils/src/utils/ensureArray.ts
condenser-0.0.5 lib/condenser/processors/node_modules/rollup-pluginutils/src/utils/ensureArray.ts