JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 49
  • Score
    100M100P100Q54344F
  • License MIT

Plugin for [minibase][] and [base][], that adds `.visit` method to your application to visit a method over the items in an object, or map visit over the objects in an array. Using using [collection-visit][] package.

Package Exports

  • minibase-visit

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (minibase-visit) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

minibase-visit npmjs.com The MIT License npm downloads

Plugin for minibase and base, that adds .visit method to your application to visit a method over the items in an object, or map visit over the objects in an array. Using using collection-visit package.

code climate standard code style travis build status coverage status dependency status

Install

Install with npm

$ npm i minibase-visit --save

Usage

For more use-cases see the tests

const minibaseVisit = require('minibase-visit')

API

minibaseVisit

Adds .visit method to your application. That opts option is optional and does nothing. It is just convention each plugin to export function that returns a plugin.

Params

  • opts {Object}: optional, no options currently
  • returns {Function}: plugin that can be pass to base/minibase's .use method

Example

var visit = require('minibase-visit')

var MiniBase = require('minibase').MiniBase
var app = new MiniBase()
app.use(visit())

// or as Base plugin

var Base = require('base')
var base = new Base()
base.use(visit())

.visit

Visit method over the properties in the base/minibase instance or map visit over the object-elements in an array. More info can see on collection-visit to understand how this works.

Params

  • method {String}: method to be called on each item in value, recursively
  • value {Array|Object}: object/array to be visited
  • returns {Object}: MiniBase/Base instance for chaining

Example

var visit = require('minibase-visit')
var app = require('minibase')

app.use(visit())

var context = {}

app.foobar = function foobar (key, value) {
  context[key] = value
}

app.visit('foobar', {
  aa: 123,
  cc: {
    dd: 'bbb'
  }
})

console.log(context.aa) // => 123
console.log(context.cc) // => { dd: 'bbb' }
console.log(context.dd) // => 'bbb'

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.

Charlike Make Reagent new message to charlike freenode #charlike

tunnckoCore.tk keybase tunnckoCore tunnckoCore npm tunnckoCore twitter tunnckoCore github