collection-visit (1.0.0)

Published 2026-02-24 13:54:07 +00:00 by atheaadmin

Installation

registry=
npm install collection-visit@1.0.0
"collection-visit": "1.0.0"

About this package

collection-visit NPM version NPM monthly downloads NPM total downloads Linux Build Status

Visit a method over the items in an object, or map visit over the objects in an array.

Install

Install with npm:

$ npm install --save collection-visit

Usage

var visit = require('collection-visit');

var ctx = {
  data: {},
  set: function (key, value) {
    if (typeof key === 'object') {
      visit(ctx, 'set', key);
    } else {
      ctx.data[key] = value;
    }
  }
};

ctx.set('a', 'a');
ctx.set('b', 'b');
ctx.set('c', 'c');
ctx.set({d: {e: 'f'}});

console.log(ctx.data);
//=> {a: 'a', b: 'b', c: 'c', d: { e: 'f' }};

About

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Contributors

Commits Contributor
13 jonschlinkert
9 doowb

Building docs

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test

Author

Jon Schlinkert

License

Copyright © 2017, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.5.0, on April 09, 2017.

Dependencies

Dependencies

ID Version
map-visit ^1.0.0
object-visit ^1.0.0

Development Dependencies

ID Version
clone-deep ^0.2.4
gulp ^3.9.1
gulp-eslint ^3.0.1
gulp-format-md ^0.1.12
gulp-istanbul ^1.1.1
gulp-mocha ^3.0.0
mocha ^3.2.0

Keywords

array arrays collection context function helper invoke key map method object objects value visit visitor
Details
npm
2026-02-24 13:54:07 +00:00
0
Jon Schlinkert
MIT
latest
2.8 KiB
Assets (1)
Versions (1) View all
1.0.0 2026-02-24