Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

iterate-object

Support me on Patreon Buy me a book PayPal Ask me anything Version Downloads Get help on Codementor

Buy Me A Coffee

A convenient way to iterate objects.

☁️ Installation

# Using npm
npm install --save iterate-object

# Using yarn
yarn add 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

❓ Get Help

There are few ways to get help:

  1. Please post questions on Stack Overflow. You can open issues with questions, as long you add a link to your Stack Overflow question.

  2. For bug reports and feature requests, open issues. 🐛

  3. For direct and quick help, you can use Codementor. 🚀

📝 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.

💖 Support my projects

I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously, this takes time. You can integrate and use these projects in your applications for free! You can even change the source code and redistribute (even resell it).

However, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:

  • Starring and sharing the projects you like 🚀

  • Buy me a book—I love books! I will remember you after years if you buy me one. 😁 📖

  • PayPal—You can make one-time donations via PayPal. I'll probably buy a coffee tea. 🍵

  • Support me on Patreon—Set up a recurring monthly donation and you will get interesting news about what I'm doing (things that I don't share with everyone).

  • Bitcoin—You can send me bitcoins at this address (or scanning the code below): 1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6

Thanks! ❤️

💫 Where is this library used?

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

  • barbe—Like mustache, but simple, tiny and fast.
  • bloggify-actions (by Bloggify)—High-level module for building the actions functionality. Core module.
  • bloggify-config (by Bloggify)—Helper module to create Bloggify configuration.
  • bloggify-flexible-router (by Bloggify)—A flexible router for Bloggify apps.
  • bloggify-mongoose (by Bloggify)—Support for Mongoose models in Bloggify.
  • bloggify-on-request—Do custom stuff on request and optionally send a custom response.
  • bloggify-page (by Bloggify)—The Bloggify page class.
  • bloggify-paths—Helper library for maintaining the Bloggify paths in one place.
  • bloggify-redirect—A Bloggify plugin to handle the link redirects.
  • bloggify-sequelize (by Bloggify)—Use Sequelize in Bloggify applications.
  • bloggify-shortcode—Shortcode plugin for Bloggify.
  • bloggify-template-renderer (by Bloggify)—The default template renderer for Bloggify.
  • bloggify-theme-renderer (by Bloggify)—The default theme renderer for Bloggify.
  • color-it—Flat colors for your Node.js strings.
  • couleurs—Add some color and styles to your Node.JS strings.
  • edit-json-file—Edit a json file with ease.
  • elly—A tiny library for creating and selecting DOM elements.
  • emoji-from-word—Get emoji from input word.
  • emoji-name-map—Name to unicode emoji mapping.
  • emoji-unicode-map—Unicode to name emoji mapping.
  • emoji.css—Your website. Emojified. Like FontAwesome for emojis.
  • 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.
  • error-creator (by Bloggify)—Create errors with dynamic parameters and i18n in mind.
  • 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.
  • html-encoder-decoder—HTML Encoder / Decoder - Converts characters to their corresponding HTML Entities
  • lien—An easy to use web framework for Node.js.
  • love-you—"I love you" in different languages.
  • map-o—Array-map like function for objects.
  • match—Simplest way to create match memory games.
  • mini-lightbox—Minimalist image lightbox
  • 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.
  • remove-one-element-arrays—Removes the one-element arrays from an object.
  • rucksack (by Bloggify)—JavaScript and CSS bundler.
  • scrape-it—A Node.js scraper for humans.
  • scrape-it-plus (by Rukanda Faridsi)—A Node.js scraper for humans (with extended function).
  • stringify-env (by Bloggify)—Create files storing environment variables.
  • svg.connectable.js (by jillix)—A JavaScript library for connecting SVG things.
  • tilda—Tiny module for building command line tools.
  • validate5—Form validations made easy.
  • xml-jsonify—A liberal XML to JSON converter.

📜 License

MIT © Ionică Bizău