Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

array-iterate

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

array-iterate - npm Package Compare versions

Comparing version 0.1.0 to 1.0.0

history.md

52

index.js

@@ -0,10 +1,29 @@

/**
* @author Titus Wormer
* @copyright 2015 Titus Wormer
* @license MIT
* @module array-iterate
* @fileoverview `forEach` with the possibility to change the next position.
*/
'use strict';
/**
* Cache `hasOwnProperty`.
/* eslint-env commonjs */
/*
* Methods.
*/
var has;
var has = Object.prototype.hasOwnProperty;
has = Object.prototype.hasOwnProperty;
/**
* Callback given to `iterate`.
*
* @callback iterate~callback
* @this {*} - `context`, when given to `iterate`.
* @param {*} value - Current iteration.
* @param {number} index - Position of `value` in `values`.
* @param {{length: number}} values - Currently iterated over.
* @return {number?} - Position to go to next.
*/

@@ -15,10 +34,9 @@ /**

*
* @param {{length: number}} values
* @param {function(*, number, {length: number}): number|undefined} callback
* @param {*} context
* @param {{length: number}} values - Values.
* @param {arrayIterate~callback} callback - Callback given to `iterate`.
* @param {*?} [context] - Context object to use when invoking `callback`.
*/
function iterate(values, callback, context) {
var index,
result;
var index = -1;
var result;

@@ -45,5 +63,3 @@ if (!values) {

index = -1;
/**
/*
* The length might change, so we do not cache it.

@@ -53,3 +69,3 @@ */

while (++index < values.length) {
/**
/*
* Skip missing values.

@@ -64,3 +80,3 @@ */

/**
/*
* If `callback` returns a `number`, move `index` over to

@@ -71,3 +87,3 @@ * `number`.

if (typeof result === 'number') {
/**
/*
* Make sure that negative numbers do not

@@ -86,6 +102,6 @@ * break the loop.

/**
* Expose `iterate`.
/*
* Expose.
*/
module.exports = iterate;
{
"name": "array-iterate",
"version": "0.1.0",
"version": "1.0.0",
"description": "forEach with the possibility to change the next position",

@@ -12,23 +12,36 @@ "license": "MIT",

],
"repository": {
"type": "git",
"url": "https://github.com/wooorm/array-iterate.git"
},
"repository": "wooorm/array-iterate",
"author": "Titus Wormer <tituswormer@gmail.com>",
"files": [
"index.js"
],
"devDependencies": {
"eslint": "^0.10.0",
"browserify": "^11.0.0",
"eslint": "^1.0.0",
"esmangle": "^1.0.0",
"istanbul": "^0.3.0",
"jscs": "^1.0.0",
"jscs": "^2.0.0",
"jscs-jsdoc": "^1.0.0",
"mdast": "^1.0.0",
"mdast-comment-config": "^1.0.0",
"mdast-github": "^1.0.0",
"mdast-lint": "^1.0.0",
"mdast-slug": "^1.0.0",
"mdast-validate-links": "^1.0.0",
"mocha": "^2.0.0"
},
"scripts": {
"test": "node_modules/.bin/_mocha --reporter spec --check-leaks -u exports test.js",
"test-travis": "node_modules/.bin/istanbul cover node_modules/.bin/_mocha --report lcovonly -- --reporter spec --check-leaks -u exports test.js",
"coverage": "node_modules/.bin/istanbul cover node_modules/.bin/_mocha -- -- test.js",
"lint-api": "node_modules/.bin/eslint index.js",
"lint-test": "node_modules/.bin/eslint test.js --env mocha",
"lint-style": "node_modules/.bin/jscs index.js test.js --reporter=inline",
"lint": "npm run lint-api && npm run lint-test && npm run lint-style",
"make": "npm run lint && npm run coverage"
"test-api": "mocha --check-leaks test.js",
"test-coverage": "istanbul cover _mocha -- test.js",
"test-travis": "npm run test-coverage",
"test": "npm run test-api",
"lint-api": "eslint .",
"lint-style": "jscs --reporter inline .",
"lint": "npm run lint-api && npm run lint-style",
"make": "npm run lint && npm run test-coverage",
"bundle": "browserify index.js --no-builtins -s arrayIterate > array-iterate.js",
"postbundle": "esmangle array-iterate.js > array-iterate.min.js",
"build-md": "mdast . --quiet",
"build": "npm run bundle && npm run build-md"
}
}

Sorry, the diff of this file is not supported yet

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