├── .editorconfig ├── .eslintrc.json ├── .gitattributes ├── .gitignore ├── .travis.yml ├── .verb.md ├── LICENSE ├── README.md ├── bower.json ├── example.js ├── index.js ├── package.json ├── test.js └── utils.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | end_of_line = lf 6 | charset = utf-8 7 | indent_size = 2 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [{**/{actual,fixtures,expected,templates}/**,*.md}] 12 | trim_trailing_whitespace = false 13 | insert_final_newline = false -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "ecmaFeatures": { 3 | "modules": true, 4 | "experimentalObjectRestSpread": true 5 | }, 6 | 7 | "env": { 8 | "browser": false, 9 | "es6": true, 10 | "node": true, 11 | "mocha": true 12 | }, 13 | 14 | "globals": { 15 | "document": false, 16 | "navigator": false, 17 | "window": false 18 | }, 19 | 20 | "rules": { 21 | "accessor-pairs": 2, 22 | "arrow-spacing": [2, { "before": true, "after": true }], 23 | "block-spacing": [2, "always"], 24 | "brace-style": [2, "1tbs", { "allowSingleLine": true }], 25 | "comma-dangle": [2, "never"], 26 | "comma-spacing": [2, { "before": false, "after": true }], 27 | "comma-style": [2, "last"], 28 | "constructor-super": 2, 29 | "curly": [2, "multi-line"], 30 | "dot-location": [2, "property"], 31 | "eol-last": 2, 32 | "eqeqeq": [2, "allow-null"], 33 | "generator-star-spacing": [2, { "before": true, "after": true }], 34 | "handle-callback-err": [2, "^(err|error)$" ], 35 | "indent": [2, 2, { "SwitchCase": 1 }], 36 | "key-spacing": [2, { "beforeColon": false, "afterColon": true }], 37 | "keyword-spacing": [2, { "before": true, "after": true }], 38 | "new-cap": [2, { "newIsCap": true, "capIsNew": false }], 39 | "new-parens": 2, 40 | "no-array-constructor": 2, 41 | "no-caller": 2, 42 | "no-class-assign": 2, 43 | "no-cond-assign": 2, 44 | "no-const-assign": 2, 45 | "no-control-regex": 2, 46 | "no-debugger": 2, 47 | "no-delete-var": 2, 48 | "no-dupe-args": 2, 49 | "no-dupe-class-members": 2, 50 | "no-dupe-keys": 2, 51 | "no-duplicate-case": 2, 52 | "no-empty-character-class": 2, 53 | "no-eval": 2, 54 | "no-ex-assign": 2, 55 | "no-extend-native": 2, 56 | "no-extra-bind": 2, 57 | "no-extra-boolean-cast": 2, 58 | "no-extra-parens": [2, "functions"], 59 | "no-fallthrough": 2, 60 | "no-floating-decimal": 2, 61 | "no-func-assign": 2, 62 | "no-implied-eval": 2, 63 | "no-inner-declarations": [2, "functions"], 64 | "no-invalid-regexp": 2, 65 | "no-irregular-whitespace": 2, 66 | "no-iterator": 2, 67 | "no-label-var": 2, 68 | "no-labels": 2, 69 | "no-lone-blocks": 2, 70 | "no-mixed-spaces-and-tabs": 2, 71 | "no-multi-spaces": 2, 72 | "no-multi-str": 2, 73 | "no-multiple-empty-lines": [2, { "max": 1 }], 74 | "no-native-reassign": 0, 75 | "no-negated-in-lhs": 2, 76 | "no-new": 2, 77 | "no-new-func": 2, 78 | "no-new-object": 2, 79 | "no-new-require": 2, 80 | "no-new-wrappers": 2, 81 | "no-obj-calls": 2, 82 | "no-octal": 2, 83 | "no-octal-escape": 2, 84 | "no-proto": 0, 85 | "no-redeclare": 2, 86 | "no-regex-spaces": 2, 87 | "no-return-assign": 2, 88 | "no-self-compare": 2, 89 | "no-sequences": 2, 90 | "no-shadow-restricted-names": 2, 91 | "no-spaced-func": 2, 92 | "no-sparse-arrays": 2, 93 | "no-this-before-super": 2, 94 | "no-throw-literal": 2, 95 | "no-trailing-spaces": 0, 96 | "no-undef": 2, 97 | "no-undef-init": 2, 98 | "no-unexpected-multiline": 2, 99 | "no-unneeded-ternary": [2, { "defaultAssignment": false }], 100 | "no-unreachable": 2, 101 | "no-unused-vars": [2, { "vars": "all", "args": "none" }], 102 | "no-useless-call": 0, 103 | "no-with": 2, 104 | "one-var": [0, { "initialized": "never" }], 105 | "operator-linebreak": [0, "after", { "overrides": { "?": "before", ":": "before" } }], 106 | "padded-blocks": [0, "never"], 107 | "quotes": [2, "single", "avoid-escape"], 108 | "radix": 2, 109 | "semi": [2, "always"], 110 | "semi-spacing": [2, { "before": false, "after": true }], 111 | "space-before-blocks": [2, "always"], 112 | "space-before-function-paren": [2, "never"], 113 | "space-in-parens": [2, "never"], 114 | "space-infix-ops": 2, 115 | "space-unary-ops": [2, { "words": true, "nonwords": false }], 116 | "spaced-comment": [0, "always", { "markers": ["global", "globals", "eslint", "eslint-disable", "*package", "!", ","] }], 117 | "use-isnan": 2, 118 | "valid-typeof": 2, 119 | "wrap-iife": [2, "any"], 120 | "yoda": [2, "never"] 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Enforce Unix newlines 2 | * text eol=lf 3 | 4 | # binaries 5 | *.ai binary 6 | *.psd binary 7 | *.jpg binary 8 | *.gif binary 9 | *.png binary 10 | *.jpeg binary 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store 2 | *.sublime-* 3 | _gh_pages 4 | bower_components 5 | node_modules 6 | npm-debug.log 7 | actual 8 | test/actual 9 | temp 10 | tmp 11 | TODO.md 12 | vendor 13 | .idea 14 | benchmark 15 | coverage 16 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | node_js: 4 | - '6' 5 | - '5' 6 | - '4' 7 | - '0.12' 8 | - '0.10' 9 | matrix: 10 | fast_finish: true 11 | allow_failures: 12 | - node_js: '4' 13 | - node_js: '0.10' 14 | - node_js: '0.12' 15 | -------------------------------------------------------------------------------- /.verb.md: -------------------------------------------------------------------------------- 1 | {{#block "logo"}}{{/block}} 2 | ## Usage 3 | 4 | ```js 5 | var mapVisit = require('{%= name %}'); 6 | ``` 7 | 8 | ## Assign or Merge vs. Visit 9 | 10 | Let's say you want to add a `set` method to your application that will: 11 | 12 | - set key-value pairs on a `data` object 13 | - extend objects onto the `data` object 14 | - extend arrays of objects onto the data object 15 | 16 | **Example using `extend`** 17 | 18 | Here is one way to accomplish this using Lo-Dash's `extend`: 19 | 20 | ```js 21 | var _ = require('lodash'); 22 | 23 | var obj = { 24 | data: {}, 25 | set: function (key, value) { 26 | if (Array.isArray(key)) { 27 | _.extend.apply(_, [obj.data].concat(key)); 28 | } else if (typeof key === 'object') { 29 | _.extend(obj.data, key); 30 | } else { 31 | obj.data[key] = value; 32 | } 33 | } 34 | }; 35 | 36 | obj.set('a', 'a'); 37 | obj.set([{b: 'b'}, {c: 'c'}]); 38 | obj.set({d: {e: 'f'}}); 39 | 40 | console.log(obj.data); 41 | //=> {a: 'a', b: 'b', c: 'c', d: { e: 'f' }} 42 | ``` 43 | 44 | 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`. 45 | 46 | **Example using `visit`** 47 | 48 | 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`. 49 | 50 | ```js 51 | var mapVisit = require('{%= name %}'); 52 | var visit = require('object-visit'); 53 | 54 | var obj = { 55 | data: {}, 56 | set: function (key, value) { 57 | if (Array.isArray(key)) { 58 | mapVisit(obj, 'set', key); 59 | } else if (typeof key === 'object') { 60 | visit(obj, 'set', key); 61 | } else { 62 | // some event-emitter 63 | console.log('emit', key, value); 64 | obj.data[key] = value; 65 | } 66 | } 67 | }; 68 | 69 | obj.set('a', 'a'); 70 | obj.set([{b: 'b'}, {c: 'c'}]); 71 | obj.set({d: {e: 'f'}}); 72 | obj.set({g: 'h', i: 'j', k: 'l'}); 73 | 74 | console.log(obj.data); 75 | //=> {a: 'a', b: 'b', c: 'c', d: { e: 'f' }, g: 'h', i: 'j', k: 'l'} 76 | 77 | // events would look something like: 78 | // emit a a 79 | // emit b b 80 | // emit c c 81 | // emit d { e: 'f' } 82 | // emit g h 83 | // emit i j 84 | // emit k l 85 | ``` 86 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-2016, Jon Schlinkert 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 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) 2 | 3 | Map `visit` over an array of objects. 4 | 5 | ## Install 6 | 7 | Install with [npm](https://www.npmjs.com/): 8 | 9 | ```sh 10 | $ npm install --save map-visit 11 | ``` 12 | 13 | ## Usage 14 | 15 | ```js 16 | var mapVisit = require('map-visit'); 17 | ``` 18 | 19 | ## Assign or Merge vs. Visit 20 | 21 | Let's say you want to add a `set` method to your application that will: 22 | 23 | * set key-value pairs on a `data` object 24 | * extend objects onto the `data` object 25 | * extend arrays of objects onto the data object 26 | 27 | **Example using `extend`** 28 | 29 | Here is one way to accomplish this using Lo-Dash's `extend`: 30 | 31 | ```js 32 | var _ = require('lodash'); 33 | 34 | var obj = { 35 | data: {}, 36 | set: function (key, value) { 37 | if (Array.isArray(key)) { 38 | _.extend.apply(_, [obj.data].concat(key)); 39 | } else if (typeof key === 'object') { 40 | _.extend(obj.data, key); 41 | } else { 42 | obj.data[key] = value; 43 | } 44 | } 45 | }; 46 | 47 | obj.set('a', 'a'); 48 | obj.set([{b: 'b'}, {c: 'c'}]); 49 | obj.set({d: {e: 'f'}}); 50 | 51 | console.log(obj.data); 52 | //=> {a: 'a', b: 'b', c: 'c', d: { e: 'f' }} 53 | ``` 54 | 55 | 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`. 56 | 57 | **Example using `visit`** 58 | 59 | 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`. 60 | 61 | ```js 62 | var mapVisit = require('map-visit'); 63 | var visit = require('object-visit'); 64 | 65 | var obj = { 66 | data: {}, 67 | set: function (key, value) { 68 | if (Array.isArray(key)) { 69 | mapVisit(obj, 'set', key); 70 | } else if (typeof key === 'object') { 71 | visit(obj, 'set', key); 72 | } else { 73 | // some event-emitter 74 | console.log('emit', key, value); 75 | obj.data[key] = value; 76 | } 77 | } 78 | }; 79 | 80 | obj.set('a', 'a'); 81 | obj.set([{b: 'b'}, {c: 'c'}]); 82 | obj.set({d: {e: 'f'}}); 83 | obj.set({g: 'h', i: 'j', k: 'l'}); 84 | 85 | console.log(obj.data); 86 | //=> {a: 'a', b: 'b', c: 'c', d: { e: 'f' }, g: 'h', i: 'j', k: 'l'} 87 | 88 | // events would look something like: 89 | // emit a a 90 | // emit b b 91 | // emit c c 92 | // emit d { e: 'f' } 93 | // emit g h 94 | // emit i j 95 | // emit k l 96 | ``` 97 | 98 | ## About 99 | 100 | ### Related projects 101 | 102 | * [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.") 103 | * [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.") 104 | 105 | ### Contributing 106 | 107 | Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). 108 | 109 | ### Building docs 110 | 111 | _(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).)_ 112 | 113 | To generate the readme and API documentation with [verb](https://github.com/verbose/verb): 114 | 115 | ```sh 116 | $ npm install -g verb verb-generate-readme && verb 117 | ``` 118 | 119 | ### Running tests 120 | 121 | Install dev dependencies: 122 | 123 | ```sh 124 | $ npm install -d && npm test 125 | ``` 126 | 127 | ### Author 128 | 129 | **Jon Schlinkert** 130 | 131 | * [github/jonschlinkert](https://github.com/jonschlinkert) 132 | * [twitter/jonschlinkert](http://twitter.com/jonschlinkert) 133 | 134 | ### License 135 | 136 | Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). 137 | Released under the [MIT license](https://github.com/jonschlinkert/map-visit/blob/master/LICENSE). 138 | 139 | *** 140 | 141 | _This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on August 05, 2016._ -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "map-visit", 3 | "description": "Map `visit` over an array of objects.", 4 | "repository": "jonschlinkert/map-visit", 5 | "license": "MIT", 6 | "homepage": "https://github.com/jonschlinkert/map-visit", 7 | "authors": [ 8 | "Jon Schlinkert (https://github.com/jonschlinkert)" 9 | ], 10 | "main": [ 11 | "index.js" 12 | ], 13 | "dependencies": { 14 | "lazy-cache": "^0.2.4", 15 | "object-visit": "^0.3.1" 16 | }, 17 | "devDependencies": { 18 | "mocha": "*", 19 | "should": "*" 20 | }, 21 | "keywords": [ 22 | "array", 23 | "arrays", 24 | "function", 25 | "helper", 26 | "invoke", 27 | "key", 28 | "map", 29 | "method", 30 | "object", 31 | "objects", 32 | "value", 33 | "visit", 34 | "visitor" 35 | ] 36 | } -------------------------------------------------------------------------------- /example.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Example using Lo-Dash's extend (without visit) 3 | */ 4 | 5 | var _ = require('lodash'); 6 | 7 | var obj = { 8 | data: {}, 9 | set: function(key, value) { 10 | if (Array.isArray(key)) { 11 | _.extend.apply(_, [obj.data].concat(key)); 12 | } else if (typeof key === 'object') { 13 | _.extend(obj.data, key); 14 | } else { 15 | obj.data[key] = value; 16 | } 17 | } 18 | }; 19 | 20 | obj.set('a', 'a'); 21 | obj.set([{b: 'b'}, {c: 'c'}]); 22 | obj.set({d: {e: 'f'}}); 23 | 24 | console.log(obj.data); 25 | //=> {a: 'a', b: 'b', c: 'c', d: { e: 'f' }} 26 | 27 | /** 28 | * Example using `mapVisit` 29 | */ 30 | 31 | var mapVisit = require('./'); 32 | var visit = require('object-visit'); 33 | 34 | obj = { 35 | data: {}, 36 | set: function(key, value) { 37 | if (Array.isArray(key)) { 38 | mapVisit(obj, 'set', key); 39 | } else if (typeof key === 'object') { 40 | visit(obj, 'set', key); 41 | } else { 42 | // some event-emitter 43 | console.log('emit', key, value); 44 | obj.data[key] = value; 45 | } 46 | } 47 | }; 48 | 49 | obj.set('a', 'a'); 50 | obj.set([{b: 'b'}, {c: 'c'}]); 51 | obj.set({d: {e: 'f'}}); 52 | obj.set({g: 'h', i: 'j', k: 'l'}); 53 | 54 | console.log(obj.data); 55 | //=> { a: 'a', b: 'b', c: 'c', d: { e: 'f' }, g: 'h', i: 'j', k: 'l' } 56 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('./utils'); 4 | 5 | /** 6 | * Map `visit` over an array of objects. 7 | * 8 | * @param {Object} `collection` The context in which to invoke `method` 9 | * @param {String} `method` Name of the method to call on `collection` 10 | * @param {Object} `arr` Array of objects. 11 | */ 12 | 13 | module.exports = function mapVisit(collection, method, arr) { 14 | if (!Array.isArray(arr)) { 15 | throw new TypeError('expected an array'); 16 | } 17 | 18 | arr.forEach(function(val) { 19 | if (typeof val === 'string') { 20 | collection[method](val); 21 | } else { 22 | utils.visit(collection, method, val); 23 | } 24 | }); 25 | }; 26 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "map-visit", 3 | "description": "Map `visit` over an array of objects.", 4 | "version": "0.1.5", 5 | "homepage": "https://github.com/jonschlinkert/map-visit", 6 | "author": "Jon Schlinkert (https://github.com/jonschlinkert)", 7 | "repository": "jonschlinkert/map-visit", 8 | "bugs": { 9 | "url": "https://github.com/jonschlinkert/map-visit/issues" 10 | }, 11 | "license": "MIT", 12 | "files": [ 13 | "index.js", 14 | "utils.js" 15 | ], 16 | "main": "index.js", 17 | "engines": { 18 | "node": ">=0.10.0" 19 | }, 20 | "scripts": { 21 | "test": "mocha" 22 | }, 23 | "dependencies": { 24 | "lazy-cache": "^2.0.1", 25 | "object-visit": "^0.3.4" 26 | }, 27 | "devDependencies": { 28 | "gulp-format-md": "^0.1.10", 29 | "lodash": "^4.14.1", 30 | "mocha": "^3.0.1", 31 | "should": "^10.0.0" 32 | }, 33 | "keywords": [ 34 | "array", 35 | "arrays", 36 | "function", 37 | "helper", 38 | "invoke", 39 | "key", 40 | "map", 41 | "method", 42 | "object", 43 | "objects", 44 | "value", 45 | "visit", 46 | "visitor" 47 | ], 48 | "verb": { 49 | "related": { 50 | "list": [ 51 | "collection-visit", 52 | "object-visit" 53 | ] 54 | }, 55 | "toc": false, 56 | "layout": "default", 57 | "tasks": [ 58 | "readme" 59 | ], 60 | "plugins": [ 61 | "gulp-format-md" 62 | ], 63 | "lint": { 64 | "reflinks": true 65 | }, 66 | "reflinks": [ 67 | "verb", 68 | "verb-generate-readme" 69 | ] 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('mocha'); 4 | require('should'); 5 | var assert = require('assert'); 6 | var visit = require('object-visit'); 7 | var mapVisit = require('./'); 8 | 9 | var ctx = { 10 | data: {}, 11 | set: function(key, value) { 12 | if (Array.isArray(key)) { 13 | mapVisit(ctx, 'set', key); 14 | } else if (typeof key === 'object') { 15 | visit(ctx, 'set', key); 16 | } else { 17 | ctx.data[key] = value; 18 | } 19 | } 20 | }; 21 | 22 | describe('visit', function() { 23 | it('should throw an error when value is not an array.', function(done) { 24 | try { 25 | mapVisit({}, 'foo', 'bar'); 26 | done(new Error('expected an error')); 27 | } catch (err) { 28 | assert(err); 29 | assert(err.message); 30 | assert(err.message === 'expected an array'); 31 | done(); 32 | } 33 | }); 34 | 35 | it('should call visit on every value in the given object:', function() { 36 | ctx.set('a', 'a'); 37 | ctx.set([{b: 'b'}, {c: 'c'}]); 38 | ctx.set({d: {e: 'f'}}); 39 | ctx.data.should.eql({ 40 | a: 'a', 41 | b: 'b', 42 | c: 'c', 43 | d: { e: 'f' } 44 | }); 45 | }); 46 | 47 | it('should call visit on every value in the given object:', function() { 48 | ctx.set('a', 'a'); 49 | ctx.set(['x', 'y']); 50 | ctx.set([{b: 'b'}, {c: 'c'}]); 51 | ctx.set({d: {e: 'f'}}); 52 | 53 | ctx.data.should.eql({ 54 | a: 'a', 55 | b: 'b', 56 | c: 'c', 57 | d: { e: 'f' }, 58 | x: undefined, 59 | y: undefined 60 | }); 61 | }); 62 | }); 63 | -------------------------------------------------------------------------------- /utils.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var utils = require('lazy-cache')(require); 4 | var fn = require; 5 | 6 | require = utils; // trick browserify 7 | require('object-visit', 'visit'); 8 | require = fn; 9 | 10 | /** 11 | * Expose utils 12 | */ 13 | 14 | module.exports = utils; 15 | --------------------------------------------------------------------------------