A convenient way to iterate objects.
# Using npm
npm install --save iterate-object
# Using yarn
yarn add iterate-object
// 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
There are few ways to get help:
- Please post questions on Stack Overflow. You can open issues with questions, as long you add a link to your Stack Overflow question.
- For bug reports and feature requests, open issues. 🐛
- For direct and quick help, you can use Codementor. 🚀
Iterates an object. Note the object field order may differ.
- Object
obj
: The input object. - Function
fn
: A function that will be called with the current value, field name and provided object.
- Function The
iterateObject
function.
Have an idea? Found a bug? See how to contribute.
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 🚀
-
—I love books! I will remember you after years if you buy me one. 😁 📖
-
—You can make one-time donations via PayPal. I'll probably buy a
coffeetea. 🍵 -
—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! ❤️
If you are using this library in one of your projects, add it in this list. ✨
@acegoal07/json-editor
@isysd/gpm
@rivkesse/emoji-category-map
@slikts/scrape-it
@ywzhaiqi/scrape-it-core
angularvezba
barbe
bloggify
bloggify-actions
bloggify-cli
bloggify-config
bloggify-flexible-router
bloggify-mongoose
bloggify-on-request
bloggify-page
bloggify-paths
bloggify-redirect
bloggify-sequelize
bloggify-shortcode
bloggify-template-renderer
bloggify-theme-renderer
color-it
couleurs
edit-json-file
elly
emoji-from-word
emoji-unicode-map
emoji.css
emojic
engine-builder
engine-flow-types
engine-parser
enny
err
error-creator
fixmtoacrisconverter
fixmtoacrisconverterlib
fixmtoacristransformer
gh-following
git-stats
gm-tools
gpm
html-encoder-decoder
lien
love-you
map-o
markdownalint-cli2
match
mini-lightbox
nodeice
oargv
obj-flatten
obj-unflatten
remove-one-element-arrays
rucksack
scrape-it-core
scrape-it-plus
scraped-core
stringify-env
svg.connectable.js
tilda
tools_may_24
validate5
xml-jsonify