diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:01:11 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-08-14 05:02:09 +0200 |
commit | 363723fc84f7b8477592e0105aeb331ec9a017af (patch) | |
tree | 29f92724f34131bac64d6a318dd7e30612e631c7 /node_modules/collection-visit | |
parent | 5634e77ad96bfe1818f6b6ee70b7379652e5487f (diff) | |
download | wallet-core-363723fc84f7b8477592e0105aeb331ec9a017af.tar.xz |
node_modules
Diffstat (limited to 'node_modules/collection-visit')
-rw-r--r-- | node_modules/collection-visit/LICENSE | 21 | ||||
-rw-r--r-- | node_modules/collection-visit/README.md | 82 | ||||
-rw-r--r-- | node_modules/collection-visit/index.js | 33 | ||||
-rw-r--r-- | node_modules/collection-visit/package.json | 77 | ||||
-rw-r--r-- | node_modules/collection-visit/utils.js | 19 |
5 files changed, 232 insertions, 0 deletions
diff --git a/node_modules/collection-visit/LICENSE b/node_modules/collection-visit/LICENSE new file mode 100644 index 000000000..652517172 --- /dev/null +++ b/node_modules/collection-visit/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015-2016, Jon Schlinkert + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/collection-visit/README.md b/node_modules/collection-visit/README.md new file mode 100644 index 000000000..e2cb02d7a --- /dev/null +++ b/node_modules/collection-visit/README.md @@ -0,0 +1,82 @@ +# collection-visit [![NPM version](https://img.shields.io/npm/v/collection-visit.svg?style=flat)](https://www.npmjs.com/package/collection-visit) [![NPM downloads](https://img.shields.io/npm/dm/collection-visit.svg?style=flat)](https://npmjs.org/package/collection-visit) [![Build Status](https://img.shields.io/travis/jonschlinkert/collection-visit.svg?style=flat)](https://travis-ci.org/jonschlinkert/collection-visit) + +Visit a method over the items in an object, or map visit over the objects in an array. + +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save collection-visit +``` + +## Usage + +```js +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 + +### Related projects + +* [base-methods](https://www.npmjs.com/package/base-methods): base-methods is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting… [more](https://github.com/jonschlinkert/base-methods) | [homepage](https://github.com/jonschlinkert/base-methods "base-methods is the foundation for creating modular, unit testable and highly pluggable node.js applications, starting with a handful of common methods, like `set`, `get`, `del` and `use`.") +* [map-visit](https://www.npmjs.com/package/map-visit): Map `visit` over an array of objects. | [homepage](https://github.com/jonschlinkert/map-visit "Map `visit` over an array of objects.") +* [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.") + +### Contributing + +Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). + +### 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).)_ + +To generate the readme and API documentation with [verb](https://github.com/verbose/verb): + +```sh +$ npm install -g verb verb-generate-readme && verb +``` + +### Running tests + +Install dev dependencies: + +```sh +$ npm install -d && npm test +``` + +### Author + +**Jon Schlinkert** + +* [github/jonschlinkert](https://github.com/jonschlinkert) +* [twitter/jonschlinkert](http://twitter.com/jonschlinkert) + +### License + +Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). +Released under the [MIT license](https://github.com/jonschlinkert/collection-visit/blob/master/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 diff --git a/node_modules/collection-visit/index.js b/node_modules/collection-visit/index.js new file mode 100644 index 000000000..a431d5189 --- /dev/null +++ b/node_modules/collection-visit/index.js @@ -0,0 +1,33 @@ +/*! + * collection-visit <https://github.com/jonschlinkert/collection-visit> + * + * Copyright (c) 2015, Jon Schlinkert. + * Licensed under the MIT License. + */ + +'use strict'; + +var utils = require('./utils'); + +function collectionVisit(collection, method, val) { + var result; + + if (typeof val === 'string' && (method in collection)) { + result = collection[method](val); + } else if (Array.isArray(val)) { + result = utils.mapVisit(collection, method, val); + } else { + result = utils.visit(collection, method, val); + } + + if (typeof result !== 'undefined') { + return result; + } + return collection; +} + +/** + * Expose `collectionVisit` + */ + +module.exports = collectionVisit; diff --git a/node_modules/collection-visit/package.json b/node_modules/collection-visit/package.json new file mode 100644 index 000000000..b5936d43c --- /dev/null +++ b/node_modules/collection-visit/package.json @@ -0,0 +1,77 @@ +{ + "name": "collection-visit", + "description": "Visit a method over the items in an object, or map visit over the objects in an array.", + "version": "0.2.3", + "homepage": "https://github.com/jonschlinkert/collection-visit", + "author": "Jon Schlinkert (https://github.com/jonschlinkert)", + "repository": "jonschlinkert/collection-visit", + "bugs": { + "url": "https://github.com/jonschlinkert/collection-visit/issues" + }, + "license": "MIT", + "files": [ + "index.js", + "utils.js" + ], + "main": "index.js", + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "dependencies": { + "lazy-cache": "^2.0.1", + "map-visit": "^0.1.5", + "object-visit": "^0.3.4" + }, + "devDependencies": { + "gulp": "^3.9.1", + "gulp-eslint": "^3.0.1", + "gulp-format-md": "^0.1.10", + "gulp-istanbul": "^1.0.0", + "gulp-mocha": "^3.0.0", + "mocha": "^3.0.1", + "should": "^10.0.0" + }, + "keywords": [ + "array", + "arrays", + "context", + "function", + "helper", + "invoke", + "key", + "map", + "method", + "object", + "objects", + "value", + "visit", + "visitor" + ], + "verb": { + "related": { + "list": [ + "base-methods", + "object-visit", + "map-visit" + ] + }, + "toc": false, + "layout": "default", + "tasks": [ + "readme" + ], + "plugins": [ + "gulp-format-md" + ], + "lint": { + "reflinks": true + }, + "reflinks": [ + "verb", + "verb-generate-readme" + ] + } +} diff --git a/node_modules/collection-visit/utils.js b/node_modules/collection-visit/utils.js new file mode 100644 index 000000000..f619e898a --- /dev/null +++ b/node_modules/collection-visit/utils.js @@ -0,0 +1,19 @@ +'use strict'; + +/** + * Lazily required module dependencies + */ + +var utils = require('lazy-cache')(require); +var fn = require; + +require = utils; // trick browserify so we can lazy-cache +require('map-visit'); +require('object-visit', 'visit'); +require = fn; + +/** + * Expose `utils` + */ + +module.exports = utils; |