{
  "_args": [
    [
      {
        "raw": "map-visit@^1.0.0",
        "scope": null,
        "escapedName": "map-visit",
        "name": "map-visit",
        "rawSpec": "^1.0.0",
        "spec": ">=1.0.0 <2.0.0",
        "type": "range"
      },
      "/home/zkochan/src/pnpm/packages/pnpm/node_modules/collection-visit"
    ]
  ],
  "_from": "map-visit@>=1.0.0 <2.0.0",
  "_id": "map-visit@1.0.0",
  "_inCache": true,
  "_location": "/map-visit",
  "_nodeVersion": "7.7.3",
  "_npmOperationalInternal": {
    "host": "packages-12-west.internal.npmjs.com",
    "tmp": "tmp/map-visit-1.0.0.tgz_1491774214052_0.825954457744956"
  },
  "_npmUser": {
    "name": "jonschlinkert",
    "email": "github@sellside.com"
  },
  "_npmVersion": "4.1.2",
  "_phantomChildren": {},
  "_requested": {
    "raw": "map-visit@^1.0.0",
    "scope": null,
    "escapedName": "map-visit",
    "name": "map-visit",
    "rawSpec": "^1.0.0",
    "spec": ">=1.0.0 <2.0.0",
    "type": "range"
  },
  "_requiredBy": [
    "/collection-visit"
  ],
  "_resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz",
  "_shasum": "ecdca8f13144e660f1b5bd41f12f3479d98dfb8f",
  "_shrinkwrap": null,
  "_spec": "map-visit@^1.0.0",
  "_where": "/home/zkochan/src/pnpm/packages/pnpm/node_modules/collection-visit",
  "author": {
    "name": "Jon Schlinkert",
    "url": "https://github.com/jonschlinkert"
  },
  "bugs": {
    "url": "https://github.com/jonschlinkert/map-visit/issues"
  },
  "contributors": [
    {
      "name": "Brian Woodward",
      "email": "brian.woodward@gmail.com",
      "url": "https://twitter.com/doowb"
    },
    {
      "name": "Jon Schlinkert",
      "email": "jon.schlinkert@sellside.com",
      "url": "http://twitter.com/jonschlinkert"
    }
  ],
  "dependencies": {
    "object-visit": "^1.0.0"
  },
  "description": "Map `visit` over an array of objects.",
  "devDependencies": {
    "clone-deep": "^0.2.4",
    "extend-shallow": "^2.0.1",
    "gulp-format-md": "^0.1.12",
    "lodash": "^4.17.4",
    "mocha": "^3.2.0"
  },
  "directories": {},
  "dist": {
    "shasum": "ecdca8f13144e660f1b5bd41f12f3479d98dfb8f",
    "tarball": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz"
  },
  "engines": {
    "node": ">=0.10.0"
  },
  "files": [
    "index.js"
  ],
  "gitHead": "73bcd8385c9520c595a825486f19623a5e0550f0",
  "homepage": "https://github.com/jonschlinkert/map-visit",
  "keywords": [
    "array",
    "arrays",
    "function",
    "helper",
    "invoke",
    "key",
    "map",
    "method",
    "object",
    "objects",
    "value",
    "visit",
    "visitor"
  ],
  "license": "MIT",
  "main": "index.js",
  "maintainers": [
    {
      "name": "doowb",
      "email": "brian.woodward@gmail.com"
    },
    {
      "name": "jonschlinkert",
      "email": "github@sellside.com"
    }
  ],
  "name": "map-visit",
  "optionalDependencies": {},
  "readme": "# 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)\n\n> Map `visit` over an array of objects.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save map-visit\n```\n\n## Usage\n\n```js\nvar mapVisit = require('map-visit');\n```\n\n## What does this do?\n\n**Assign/Merge/Extend vs. Visit**\n\nLet's say you want to add a `set` method to your application that will:\n\n* set key-value pairs on a `data` object\n* extend objects onto the `data` object\n* extend arrays of objects onto the data object\n\n**Example using `extend`**\n\nHere is one way to accomplish this using Lo-Dash's `extend` (comparable to `Object.assign`):\n\n```js\nvar _ = require('lodash');\n\nvar obj = {\n  data: {},\n  set: function (key, value) {\n    if (Array.isArray(key)) {\n      _.extend.apply(_, [obj.data].concat(key));\n    } else if (typeof key === 'object') {\n      _.extend(obj.data, key);\n    } else {\n      obj.data[key] = value;\n    }\n  }\n};\n\nobj.set('a', 'a');\nobj.set([{b: 'b'}, {c: 'c'}]);\nobj.set({d: {e: 'f'}});\n\nconsole.log(obj.data);\n//=> {a: 'a', b: 'b', c: 'c', d: { e: 'f' }}\n```\n\nThe 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`.\n\n**Example using `visit`**\n\nIn this approach:\n\n* when an array is passed to `set`, the `mapVisit` library calls the `set` method on each object in the array.\n* when an object is passed, `visit` calls `set` on each property in the object.\n\nAs 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).\n\n```js\nvar mapVisit = require('map-visit');\nvar visit = require('object-visit');\n\nvar obj = {\n  data: {},\n  set: function (key, value) {\n    if (Array.isArray(key)) {\n      mapVisit(obj, 'set', key);\n    } else if (typeof key === 'object') {\n      visit(obj, 'set', key);\n    } else {\n      // simulate an event-emitter\n      console.log('emit', key, value);\n      obj.data[key] = value;\n    }\n  }\n};\n\nobj.set('a', 'a');\nobj.set([{b: 'b'}, {c: 'c'}]);\nobj.set({d: {e: 'f'}});\nobj.set({g: 'h', i: 'j', k: 'l'});\n\nconsole.log(obj.data);\n//=> {a: 'a', b: 'b', c: 'c', d: { e: 'f' }, g: 'h', i: 'j', k: 'l'}\n\n// events would look something like:\n// emit a a\n// emit b b\n// emit c c\n// emit d { e: 'f' }\n// emit g h\n// emit i j\n// emit k l\n```\n\n## About\n\n### Related projects\n\n* [collection-visit](https://www.npmjs.com/package/collection-visit): Visit a method over the items in an object, or map visit over the objects… [more](https://github.com/jonschlinkert/collection-visit) | [homepage](https://github.com/jonschlinkert/collection-visit \"Visit a method over the items in an object, or map visit over the objects in an array.\")\n* [object-visit](https://www.npmjs.com/package/object-visit): Call a specified method on each value in the given object. | [homepage](https://github.com/jonschlinkert/object-visit \"Call a specified method on each value in the given object.\")\n\n### Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n### Contributors\n\n| **Commits** | **Contributor** | \n| --- | --- |\n| 15 | [jonschlinkert](https://github.com/jonschlinkert) |\n| 7 | [doowb](https://github.com/doowb) |\n\n### Building docs\n\n_(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.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme && verb\n```\n\n### Running tests\n\nRunning 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:\n\n```sh\n$ npm install && npm test\n```\n\n### Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)\n\n### License\n\nCopyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.5.0, on April 09, 2017._",
  "readmeFilename": "README.md",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/jonschlinkert/map-visit.git"
  },
  "scripts": {
    "test": "mocha"
  },
  "verb": {
    "toc": false,
    "layout": "default",
    "tasks": [
      "readme"
    ],
    "plugins": [
      "gulp-format-md"
    ],
    "lint": {
      "reflinks": true
    },
    "related": {
      "list": [
        "collection-visit",
        "object-visit"
      ]
    },
    "reflinks": [
      "verb",
      "verb-generate-readme"
    ]
  },
  "version": "1.0.0"
}
