aboutsummaryrefslogtreecommitdiff
path: root/node_modules/map-visit/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/map-visit/README.md')
-rw-r--r--node_modules/map-visit/README.md46
1 files changed, 30 insertions, 16 deletions
diff --git a/node_modules/map-visit/README.md b/node_modules/map-visit/README.md
index c4b75985c..5ab02d450 100644
--- a/node_modules/map-visit/README.md
+++ b/node_modules/map-visit/README.md
@@ -1,6 +1,6 @@
-# map-visit [![NPM version](https://img.shields.io/npm/v/map-visit.svg?style=flat)](https://www.npmjs.com/package/map-visit) [![NPM downloads](https://img.shields.io/npm/dm/map-visit.svg?style=flat)](https://npmjs.org/package/map-visit) [![Build Status](https://img.shields.io/travis/jonschlinkert/map-visit.svg?style=flat)](https://travis-ci.org/jonschlinkert/map-visit)
+# map-visit [![NPM version](https://img.shields.io/npm/v/map-visit.svg?style=flat)](https://www.npmjs.com/package/map-visit) [![NPM monthly downloads](https://img.shields.io/npm/dm/map-visit.svg?style=flat)](https://npmjs.org/package/map-visit) [![NPM total downloads](https://img.shields.io/npm/dt/map-visit.svg?style=flat)](https://npmjs.org/package/map-visit) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/map-visit.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/map-visit)
-Map `visit` over an array of objects.
+> Map `visit` over an array of objects.
## Install
@@ -16,7 +16,9 @@ $ npm install --save map-visit
var mapVisit = require('map-visit');
```
-## Assign or Merge vs. Visit
+## What does this do?
+
+**Assign/Merge/Extend vs. Visit**
Let's say you want to add a `set` method to your application that will:
@@ -26,7 +28,7 @@ Let's say you want to add a `set` method to your application that will:
**Example using `extend`**
-Here is one way to accomplish this using Lo-Dash's `extend`:
+Here is one way to accomplish this using Lo-Dash's `extend` (comparable to `Object.assign`):
```js
var _ = require('lodash');
@@ -52,11 +54,16 @@ console.log(obj.data);
//=> {a: 'a', b: 'b', c: 'c', d: { e: 'f' }}
```
-The above approach works fine for most use cases. But **if you also want to emit an event** each time a property is added to the `data` object. A better approach would be to use `visit`.
+The above approach works fine for most use cases. However, **if you also want to emit an event** each time a property is added to the `data` object, or you want more control over what happens as the object is extended, a better approach would be to use `visit`.
**Example using `visit`**
-In this approach, when an array is passed to `set`, `mapVisit` calls `set` on each object in the array. When an object is passed, `visit` calls `set` on each property in the object. As a result, the `data` event will be emitted every time a property is added to `data`.
+In this approach:
+
+* when an array is passed to `set`, the `mapVisit` library calls the `set` method on each object in the array.
+* when an object is passed, `visit` calls `set` on each property in the object.
+
+As a result, the `data` event will be emitted every time a property is added to `data` (events are just an example, you can use this approach to perform any necessary logic every time the method is called).
```js
var mapVisit = require('map-visit');
@@ -70,7 +77,7 @@ var obj = {
} else if (typeof key === 'object') {
visit(obj, 'set', key);
} else {
- // some event-emitter
+ // simulate an event-emitter
console.log('emit', key, value);
obj.data[key] = value;
}
@@ -106,22 +113,29 @@ console.log(obj.data);
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
+### Contributors
+
+| **Commits** | **Contributor** |
+| --- | --- |
+| 15 | [jonschlinkert](https://github.com/jonschlinkert) |
+| 7 | [doowb](https://github.com/doowb) |
+
### Building docs
-_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
+_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
-To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
+To generate the readme, run the following command:
```sh
-$ npm install -g verb verb-generate-readme && verb
+$ npm install -g verbose/verb#dev verb-generate-readme && verb
```
### Running tests
-Install dev dependencies:
+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:
```sh
-$ npm install -d && npm test
+$ npm install && npm test
```
### Author
@@ -129,13 +143,13 @@ $ npm install -d && npm test
**Jon Schlinkert**
* [github/jonschlinkert](https://github.com/jonschlinkert)
-* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
+* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
### License
-Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
-Released under the [MIT license](https://github.com/jonschlinkert/map-visit/blob/master/LICENSE).
+Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
+Released under the [MIT License](LICENSE).
***
-_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on August 05, 2016._ \ No newline at end of file
+_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.5.0, on April 09, 2017._ \ No newline at end of file