🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

arrify

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arrify - npm Package Compare versions

Comparing version

to
3.0.0

/**
Convert a value to an array.
_Supplying `null` or `undefined` results in an empty array._
_Specifying `null` or `undefined` results in an empty array._
@example
```
import arrify = require('arrify');
import arrify from 'arrify';

@@ -26,14 +26,12 @@ arrify('🦄');

*/
declare function arrify<ValueType>(
export default function arrify<ValueType>(
value: ValueType
): ValueType extends (null | undefined)
? []
? [] // eslint-disable-line @typescript-eslint/ban-types
: ValueType extends string
? [string]
: ValueType extends ReadonlyArray<unknown> // TODO: Use 'readonly unknown[]' in the next major version
? ValueType
: ValueType extends Iterable<infer T>
? T[]
: [ValueType];
export = arrify;
? [string]
: ValueType extends readonly unknown[]
? ValueType
: ValueType extends Iterable<infer T>
? T[]
: [ValueType];

@@ -1,4 +0,2 @@

'use strict';
const arrify = value => {
export default function arrify(value) {
if (value === null || value === undefined) {

@@ -21,4 +19,2 @@ return [];

return [value];
};
module.exports = arrify;
}
{
"name": "arrify",
"version": "2.0.1",
"version": "3.0.0",
"description": "Convert a value to an array",
"license": "MIT",
"repository": "sindresorhus/arrify",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=8"
"node": ">=12"
},

@@ -31,6 +34,6 @@ "scripts": {

"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
"ava": "^3.15.0",
"tsd": "^0.14.0",
"xo": "^0.39.1"
}
}

@@ -1,6 +0,5 @@

# arrify [![Build Status](https://travis-ci.org/sindresorhus/arrify.svg?branch=master)](https://travis-ci.org/sindresorhus/arrify)
# arrify
> Convert a value to an array
## Install

@@ -12,7 +11,6 @@

## Usage
```js
const arrify = require('arrify');
import arrify from 'arrify';

@@ -35,7 +33,14 @@ arrify('🦄');

*Supplying `null` or `undefined` results in an empty array.*
*Specifying `null` or `undefined` results in an empty array.*
---
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)
<div align="center">
<b>
<a href="https://tidelift.com/subscription/pkg/npm-arrify?utm_source=npm-arrify&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
</b>
<br>
<sub>
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
</sub>
</div>

Sorry, the diff of this file is not supported yet