Socket
Socket
Sign inDemoInstall

foreach

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 2.0.2

test.js

2

component.json
{
"name": "foreach",
"description": "foreach component + npm package",
"version": "2.0.0",
"version": "2.0.2",
"keywords": [],

@@ -6,0 +6,0 @@ "dependencies": {},

@@ -5,3 +5,8 @@

module.exports = function forEach (obj, fn, ctx) {
if (obj == null) return;
if (!(typeof obj === 'object' || typeof obj === 'string') || obj === null) {
throw new TypeError('can only iterate over objects, arrays and strings');
}
if (typeof fn !== 'function') {
throw new TypeError('iterator must be a function');
}
var l = obj.length;

@@ -20,1 +25,2 @@ if (l === +l) {

};
{
"name": "foreach",
"description": "foreach component + npm package",
"version": "2.0.1",
"version": "2.0.2",
"author": "Manuel Stofer <manuel@takimata.ch>",
"license": "MIT",
"main": "index.js",
"scripts": {
"test": "node test.js"
},
"repository": {

@@ -19,4 +23,23 @@ "type": "git",

"dependencies": {},
"devDependencies": {}
"devDependencies": {
"tape": "*"
},
"testling": {
"files": "test.js",
"browsers": [
"iexplore/6.0..latest",
"firefox/3.0",
"firefox/15.0..latest",
"firefox/nightly",
"chrome/4.0",
"chrome/22.0..latest",
"chrome/canary",
"opera/10.0..latest",
"opera/next",
"safari/5.0.5..latest",
"ipad/6.0..latest",
"iphone/6.0..latest"
]
}
}

@@ -6,2 +6,4 @@

[![browser support][1]][2]
## API

@@ -14,13 +16,17 @@

each([1,2,3], function (value, key) {
each([1,2,3], function (value, key, array) {
// value === 1, 2, 3
// key === 0, 1, 2
// array === [1, 2, 3]
});
each({0:1,1:2,2:3}, function (value, key) {
each({0:1,1:2,2:3}, function (value, key, object) {
// value === 1, 2, 3
// key === 0, 1, 2
// object === {0:1,1:2,2:3}
});
```
[1]: https://ci.testling.com/manuelstofer/foreach.png
[2]: https://ci.testling.com/manuelstofer/foreach

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc