New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

arraywrap

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arraywrap - npm Package Compare versions

Comparing version 1.1.1 to 2.0.0

1

arraywrap.d.ts

@@ -0,3 +1,4 @@

declare function arrayWrap<T>(): never[];
declare function arrayWrap<T>(value: T | T[]): T[];
export = arrayWrap;

29

arraywrap.js

@@ -1,21 +0,12 @@

(function () {
var isArray =
Array.isArray ||
function (value) {
return Object.prototype.toString.call(value) === "[object Array]";
};
var isArray =
Array.isArray ||
function (value) {
return Object.prototype.toString.call(value) === "[object Array]";
};
function arrayWrap(value) {
if (arguments.length) {
return isArray(value) ? value : [value];
} else {
return [];
}
module.exports = function arrayWrap(value) {
if (arguments.length) {
return isArray(value) ? value : [value];
}
if (typeof module !== "undefined") {
module.exports = arrayWrap;
} else {
this.arrayWrap = arrayWrap;
}
})();
return [];
};
{
"name": "arraywrap",
"version": "1.1.1",
"version": "2.0.0",
"description": "if it's not an array, wrap it in an array. if it's already an array, do nothing.",

@@ -23,3 +23,3 @@ "main": "arraywrap.js",

"type": "git",
"url": "https://github.com/EvanHahn/arraywrap.js.git"
"url": "https://git.sr.ht/~evanhahn/arraywrap.js"
},

@@ -34,9 +34,9 @@ "keywords": [

"bugs": {
"url": "https://github.com/EvanHahn/arraywrap.js/issues"
"email": "me@evanhahn.com"
},
"homepage": "https://github.com/EvanHahn/arraywrap.js",
"homepage": "https://git.sr.ht/~evanhahn/arraywrap.js",
"devDependencies": {
"eslint": "^8.2.0",
"prettier": "^2.4.1"
"eslint": "^8.21.0",
"prettier": "^2.7.1"
}
}

@@ -1,13 +0,13 @@

# array wrap dot js
# arraywrap.js
[![npm version](https://badge.fury.io/js/arraywrap.svg)](http://badge.fury.io/js/arraywrap)
If it's not an array, make it one:
```js
arrayWrap(123); // => [123]
arrayWrap("yo"); // => ['yo']
arrayWrap(null); // => [null]
arrayWrap(undefined); // => [undefined]
arrayWrap(); // => []
const arraywrap = require("arraywrap");
arraywrap(123); // => [123]
arraywrap("yo"); // => ['yo']
arraywrap(null); // => [null]
arraywrap(undefined); // => [undefined]
arraywrap(); // => []
```

@@ -18,25 +18,9 @@

```js
arrayWrap([1, 2, 3]); // => [1, 2, 3]
arrayWrap([]); // => []
arraywrap([1, 2, 3]); // => [1, 2, 3]
arraywrap([]); // => []
var arr = [1, 2];
const arr = [1, 2];
arrayWrap(arr) === arr; // true
```
To use it in Node/Browserify/Webpack:
```js
var arrayWrap = require("arraywrap");
arrayWrap(47);
```
To use it in the browser:
```html
<script src="arraywrap.js"></script>
<script>
arrayWrap(47);
</script>
```
This should support environments that don't have `Array.isArray` (like IE8 and below).
This supports environments that don't have `Array.isArray` (like IE8 and below).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc