$ cnpm install iterate-object
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:
iterateObject(obj, fn)Iterates an object. Note the object field order may differ.
obj: The input object.fn: A function that will be called with the current value, field name and provided object.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 :rocket:
—I love books! I will remember you after years if you buy me one. :grin: :book:
—You can make one-time donations via PayPal. I'll probably buy a
coffee tea. :tea:
—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! :heart:
If you are using this library in one of your projects, add it in this list. :sparkles:
edit-json-filescrape-iterrtildaemojiccouleurslienoargvmap-ohtml-encoder-decoderemoji-name-mapellybarbecolor-itobj-flattenxml-jsonifyemoji-unicode-mapemoji-from-wordbloggify-template-rendererbloggify-pagematcherror-creatorobj-unflattenbloggify-redirectbloggify-actionsrucksackbloggify-flexible-routergit-stats@rivkesse/emoji-category-mapbloggify-configsvg.connectable.jsengine-parserengine-builderennyengine-flow-typesmini-lightboxnodeicebloggify-mongoosegm-toolsbloggify-shortcodebloggify-pathsstringify-envbloggify-theme-rendererbloggify-on-requestscrape-it-plus@slikts/scrape-itlove-youremove-one-element-arraysvalidate5bloggify-sequelize@isysd/gpmemoji.cssgpmgh-followingCopyright 2013 - present © cnpmjs.org | Home |