JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 349581
  • Score
    100M100P100Q171980F
  • License MIT

A convenient way to iterate objects.

Package Exports

  • iterate-object

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (iterate-object) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

iterate-object PayPal Version Downloads Get help on Codementor

A convenient way to iterate objects.

☁️ Installation

$ npm i --save iterate-object

📋 Example

// Dependencies
var IterateObject = require("iterate-object");

// Iterate this object
IterateObject({
    name: "Bob"
  , age: 42
}, function (value, name) {
    console.log(name, value);
});
// => "name", "Bob"
//    "age", 42

// Iterate an array
IterateObject([
    1, 2, 3, 4, 5, 6, 7
], function (value, i) {
    console.log("v[" + i + "] = " + value);
});
// => v[0] = 1
//    v[1] = 2
//    v[2] = 3
//    v[3] = 4
//    v[4] = 5
//    v[5] = 6
//    v[6] = 7

// Iterate an array
IterateObject([
    "Alice", "Bob", "Carol", "Dave"
], function (value, i, arr) {
    console.log("Current: " + value + (arr[i + 1] ? " Next:" + arr[i + 1] : ""));
});
// => Current: Alice Next:Bob
//    Current: Bob Next:Carol
//    Current: Carol Next:Dave
//    Current: Dave

📝 Documentation

iterateObject(obj, fn)

Iterates an object. Note the object field order may differ.

Params

  • Object obj: The input object.
  • Function fn: A function that will be called with the current value, field name and provided object.

Return

  • Function The iterateObject function.

😋 How to contribute

Have an idea? Found a bug? See how to contribute.

💫 Where is this library used?

If you are using this library in one of your projects, add it in this list. ✨

  • bloggify-on-request—Do custom stuff on request and optionally send a custom response.
  • bloggify-redirect—A Bloggify plugin to handle the link redirects.
  • color-it—Flat colors for your Node.js strings.
  • couleurs—Add some color and styles to your Node.JS strings.
  • emoji-from-word—Get emoji from input word.
  • emoji-name-map—Name to unicode emoji mapping.
  • emoji-unicode-map—Unicode to name emoji mapping.
  • emojic—Emoji in your Node.js command line apps.
  • engine-builder (by jillix)—Engine composition parser.
  • engine-flow-types (by jillix)—Low level library providing Engine flow types.
  • engine-parser (by jillix)—Engine composition parser.
  • enny (by jillix)—Generate Engine compositions from human-readable inputs.
  • err—A tiny library to create custom errors in JavaScript.
  • gh-following—Fetches the users you follow but they don't follow you and the users that follow you but you don't.
  • git-stats—Local git statistics including GitHub-like contributions calendars.
  • gm-tools—Friendly tools for interacting with GraphicsMagick.
  • gpm—npm + git = gpm - Install NPM packages and dependencies from git repositories.
  • love-you—"I love you" in different languages.
  • map-o—Array-map like function for objects.
  • match—Simplest way to create match memory games.
  • nodeice—Another PDF invoice generator
  • oargv—Turns an object into a bash command.
  • obj-flatten—Convert nested objects in flatten ones.
  • obj-unflatten—Convert flatten objects in nested ones.
  • svg.connectable.js (by jillix)—A JavaScript library for connecting SVG things.

📜 License

MIT © Ionică Bizău