# simple-loop

> this a simple loop for iterating over an array or an object

Latest version **0.0.4** (published 2015-05-08) · 0 weekly downloads

## Install

```sh
npm install simple-loop
pnpm add simple-loop
yarn add simple-loop
bun add simple-loop
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2015-05-08 |
| First published | 2014-03-30 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Olivier Scherrer |
| Maintainers | podefr |
| Keywords | loop, iterate, object, array |

## Links

- npm: https://www.npmjs.com/package/simple-loop
- Repository: git@github.com:flams/simple-loop
- Homepage: https://github.com/flams/simple-loop
- Issues: https://github.com/flams/simple-loop/issues
- npm.io page: https://npm.io/package/simple-loop

## Recent versions

- 0.0.4 (latest) — 2015-05-08
- 0.0.3 — 2014-04-28
- 0.0.2 — 2014-03-30
- 0.0.1 — 2014-03-30

## README

Simple loop
=============

Simple loop is an abstraction for iterating over arrays and objects the same way.
If an array is given, it will loop over it from the first item to the last one.
If an object is given, then the order will be the same as if `for ... in` were used.
Simple loop also loops through an array which length changes while looping.

Installation
============

```bash
npm install simple-loop
```

How to use
==========

Require simple-loop:


```js
var loop = require("simple-loop");
```

Use it with an array:

```js
var anArray = ["with", "some", "data"];

loop(anArray, function (value, key, iteratedObject) {
    // this === scope;
    // value is each item
    // key is each index
    // iteratedObject === anArray
}, scope /* optional object */);
```

Use it with an object:

```js
var anObject = {
  "property1": "with",
  "property2": "some",
  "property3": "data"
};

loop(anObject, function (value, key, iteratedObject) {
    // this === scope;
    // value is each property's value
    // key is property name
    // iteratedObject === anArray
}, scope /* optional object */);
```

CHANGELOG
=========

#### 0.0.4 - 7 MAY 2015

* Remove dependency on assert and use custom assert function instead. Saves 17kb in the end after browserification. Thanks to [@tomekwi](https://github.com/tomekwi).

LICENSE
=======

MIT

---
_Source: https://npm.io/package/simple-loop · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
