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.0.0 to 1.1.0

24

arraywrap.js

@@ -1,19 +0,21 @@

;(function () {
var isArray = Array.isArray || function (value) {
return Object.prototype.toString.call(value) === '[object Array]'
}
(function () {
var isArray =
Array.isArray ||
function (value) {
return Object.prototype.toString.call(value) === "[object Array]";
};
function arrayWrap (value) {
function arrayWrap(value) {
if (arguments.length) {
return isArray(value) ? value : [value]
return isArray(value) ? value : [value];
} else {
return []
return [];
}
}
if (typeof module !== 'undefined') {
module.exports = arrayWrap
if (typeof module !== "undefined") {
module.exports = arrayWrap;
} else {
this.arrayWrap = arrayWrap
this.arrayWrap = arrayWrap;
}
})()
})();
The MIT License (MIT)
Copyright (c) 2014-2016 Evan Hahn
Copyright (c) 2014-2021 Evan Hahn

@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

{
"name": "arraywrap",
"version": "1.0.0",
"version": "1.1.0",
"description": "if it's not an array, wrap it in an array. if it's already an array, do nothing.",
"main": "arraywrap.js",
"directories": {
"test": "test"
},
"types": "arraywrap.d.ts",
"files": [
"LICENSE.txt",
"README.md",
"arraywrap.js"
],
"scripts": {
"pretest": "standard",
"test": "mocha"
"pretest": "npm run lint",
"lint": "npm run lint:eslint && npm run lint:prettier",
"lint:eslint": "eslint \"**/*.js\"",
"lint:prettier": "prettier --check .",
"format": "prettier --write .",
"test": "node test"
},

@@ -22,3 +29,3 @@ "repository": {

],
"author": "Evan Hahn <me@evanhahn.com> (http://evanhahn.com)",
"author": "Evan Hahn <me@evanhahn.com> (https://evanhahn.com)",
"license": "MIT",

@@ -30,11 +37,5 @@ "bugs": {

"devDependencies": {
"mocha": "^3.1.2",
"standard": "^8.5.0"
},
"standard": {
"globals": [
"describe",
"it"
]
"eslint": "^8.2.0",
"prettier": "^2.4.1"
}
}

@@ -1,6 +0,4 @@

array wrap dot js
=================
[![Build Status](https://travis-ci.org/EvanHahn/arraywrap.js.svg?branch=master)](https://travis-ci.org/EvanHahn/arraywrap.js)
# array wrap dot js
[![npm version](https://badge.fury.io/js/arraywrap.svg)](http://badge.fury.io/js/arraywrap)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)

@@ -10,7 +8,7 @@ If it's not an array, make it one:

```js
arrayWrap(123) // => [123]
arrayWrap('yo') // => ['yo']
arrayWrap(null) // => [null]
arrayWrap(undefined) // => [undefined]
arrayWrap() // => []
arrayWrap(123); // => [123]
arrayWrap("yo"); // => ['yo']
arrayWrap(null); // => [null]
arrayWrap(undefined); // => [undefined]
arrayWrap(); // => []
```

@@ -21,7 +19,7 @@

```js
arrayWrap([1, 2, 3]) // => [1, 2, 3]
arrayWrap([]) // => []
arrayWrap([1, 2, 3]); // => [1, 2, 3]
arrayWrap([]); // => []
var arr = [1, 2]
arrayWrap(arr) === arr // true
var arr = [1, 2];
arrayWrap(arr) === arr; // true
```

@@ -32,4 +30,4 @@

```js
var arrayWrap = require('arraywrap')
arrayWrap(47)
var arrayWrap = require("arraywrap");
arrayWrap(47);
```

@@ -41,5 +39,7 @@

<script src="arraywrap.js"></script>
<script>arrayWrap(47)</script>
<script>
arrayWrap(47);
</script>
```
This should support 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