array-foreach
Advanced tools
Sorry, the diff of this file is not supported yet
@@ -0,1 +1,13 @@ | ||
| /** | ||
| * Modules in this bundle | ||
| * @license | ||
| * | ||
| * array-foreach: | ||
| * license: MIT (http://opensource.org/licenses/MIT) | ||
| * author: Takuto Wada <takuto.wada@gmail.com> | ||
| * homepage: https://github.com/twada/array-foreach | ||
| * version: 1.0.2 | ||
| * | ||
| * This header is generated by licensify (https://github.com/twada/licensify) | ||
| */ | ||
| (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.forEach = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw (f.code="MODULE_NOT_FOUND", f)}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){ | ||
@@ -9,5 +21,5 @@ /** | ||
| * | ||
| * Copyright (c) 2015 Takuto Wada | ||
| * Copyright (c) 2015-2016 Takuto Wada | ||
| * Licensed under the MIT license. | ||
| * http://twada.mit-license.org/ | ||
| * https://github.com/twada/array-foreach/blob/master/MIT-LICENSE | ||
| */ | ||
@@ -28,2 +40,1 @@ 'use strict'; | ||
| }); | ||
+2
-2
@@ -8,5 +8,5 @@ /** | ||
| * | ||
| * Copyright (c) 2015 Takuto Wada | ||
| * Copyright (c) 2015-2016 Takuto Wada | ||
| * Licensed under the MIT license. | ||
| * http://twada.mit-license.org/ | ||
| * https://github.com/twada/array-foreach/blob/master/MIT-LICENSE | ||
| */ | ||
@@ -13,0 +13,0 @@ 'use strict'; |
+12
-31
| { | ||
| "name": "array-foreach", | ||
| "description": "Array#forEach ponyfill for older browsers", | ||
| "version": "1.0.1", | ||
| "version": "1.0.2", | ||
| "author": { | ||
@@ -12,12 +12,11 @@ "name": "Takuto Wada", | ||
| "devDependencies": { | ||
| "blanket": "^1.1.6", | ||
| "jshint": "^2.6.3", | ||
| "mocha": "^2.1.0" | ||
| "blanket": "^1.2.3", | ||
| "jshint": "^2.8.0", | ||
| "licensify": "^3.1.0", | ||
| "mocha": "^2.4.5" | ||
| }, | ||
| "files": [ | ||
| "README.md", | ||
| "MIT-LICENSE", | ||
| "index.js", | ||
| "build/array-foreach.js", | ||
| "package.json", | ||
| "test" | ||
| "build/array-foreach.js" | ||
| ], | ||
@@ -38,6 +37,3 @@ "homepage": "https://github.com/twada/array-foreach", | ||
| ], | ||
| "license": { | ||
| "type": "MIT", | ||
| "url": "http://twada.mit-license.org/" | ||
| }, | ||
| "license": "MIT", | ||
| "main": "index.js", | ||
@@ -49,24 +45,9 @@ "repository": { | ||
| "scripts": { | ||
| "build": "browserify index.js --standalone forEach | dereserve | derequire > ./build/array-foreach.js", | ||
| "build": "mkdir -p build && browserify index.js --plugin licensify --standalone forEach | dereserve | derequire > ./build/array-foreach.js", | ||
| "lint": "jshint index.js", | ||
| "cover": "mocha --require ./coverage --reporter html-cov > coverage.html", | ||
| "test": "npm run lint && mocha" | ||
| }, | ||
| "testling": { | ||
| "files": "test/*.js", | ||
| "browsers": [ | ||
| "ie/6..latest", | ||
| "chrome/22..latest", | ||
| "chrome/canary", | ||
| "firefox/16..latest", | ||
| "firefox/nightly", | ||
| "safari/5.1..latest", | ||
| "opera/12..latest", | ||
| "opera/next", | ||
| "iphone/6.0..latest", | ||
| "ipad/6.0..latest", | ||
| "android-browser/4.2..latest" | ||
| ], | ||
| "harness": "mocha" | ||
| "test": "npm run lint && mocha", | ||
| "preversion": "npm test", | ||
| "version": "npm run build && git add -A build" | ||
| } | ||
| } |
+7
-6
@@ -25,2 +25,3 @@ array-foreach | ||
| - [array-filter](https://www.npmjs.org/package/array-filter) | ||
| - [array-some](https://www.npmjs.org/package/array-some) | ||
| - [array-reduce](https://www.npmjs.org/package/array-reduce) | ||
@@ -37,4 +38,4 @@ - [indexof](https://www.npmjs.org/package/indexof) | ||
| var result = ''; | ||
| forEach(['foo', 'bar', 'baz'], function (str, idx, ary) { | ||
| result += str; | ||
| forEach(['foo', 'bar', 'baz'], function (element, index, array) { | ||
| result += element; | ||
| }); | ||
@@ -74,4 +75,4 @@ console.log(result); // 'foobarbaz' | ||
| var result = ''; | ||
| forEach(['foo', 'bar', 'baz'], function (str, idx, ary) { | ||
| result += str; | ||
| forEach(['foo', 'bar', 'baz'], function (element, index, array) { | ||
| result += element; | ||
| }); | ||
@@ -88,3 +89,3 @@ ``` | ||
| --------------------------------------- | ||
| Licensed under the [MIT](http://twada.mit-license.org/) license. | ||
| Licensed under the [MIT](https://github.com/twada/array-foreach/blob/master/MIT-LICENSE) license. | ||
@@ -104,3 +105,3 @@ | ||
| [license-url]: http://twada.mit-license.org/ | ||
| [license-url]: https://github.com/twada/array-foreach/blob/master/MIT-LICENSE | ||
| [license-image]: http://img.shields.io/badge/license-MIT-brightgreen.svg |
| 'use strict'; | ||
| var forEach = require('..'); | ||
| var assert = require('assert'); | ||
| describe('forEach', function () { | ||
| describe('iterates Array', function () { | ||
| var ary = ['foo', 'bar', 'baz']; | ||
| it('with each item', function () { | ||
| var result = ''; | ||
| forEach(ary, function (str) { | ||
| result += str; | ||
| }); | ||
| assert(result === 'foobarbaz'); | ||
| }); | ||
| it('with indices', function () { | ||
| var indices = []; | ||
| forEach(ary, function (str, idx) { | ||
| indices.push(idx); | ||
| }); | ||
| assert.deepEqual(indices, [0, 1, 2]); | ||
| }); | ||
| it('with Array itself', function () { | ||
| var collector = []; | ||
| forEach(ary, function (str, idx, itself) { | ||
| collector.push(itself); | ||
| }); | ||
| assert.deepEqual(collector, [ | ||
| ['foo', 'bar', 'baz'], | ||
| ['foo', 'bar', 'baz'], | ||
| ['foo', 'bar', 'baz'] | ||
| ]); | ||
| }); | ||
| }); | ||
| describe('exceptional cases', function () { | ||
| it('throws TypeError when ary is null', function () { | ||
| assert.throws(function () { | ||
| forEach(null, function () {}); | ||
| }, TypeError); | ||
| }); | ||
| it('throws TypeError when ary is undefined', function () { | ||
| assert.throws(function () { | ||
| forEach(undefined, function () {}); | ||
| }, TypeError); | ||
| }); | ||
| it('throws TypeError when callback is not a function', function () { | ||
| assert.throws(function () { | ||
| forEach(['foo', 'bar'], 4); | ||
| }, TypeError); | ||
| }); | ||
| }); | ||
| }); |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
103
0.98%7307
-4.27%4
33.33%60
-38.78%