[Pkg-javascript-commits] [node-collection-visit] 01/06: New upstream version 1.0.0

Praveen Arimbrathodiyil praveen at moszumanska.debian.org
Thu Jan 11 11:32:24 UTC 2018


This is an automated email from the git hooks/post-receive script.

praveen pushed a commit to branch master
in repository node-collection-visit.

commit 07df876a4a881a5c8789f210a1415210d3f6c53f
Author: Pirate Praveen <praveen at debian.org>
Date:   Wed Jan 10 19:43:54 2018 +0530

    New upstream version 1.0.0
---
 .gitignore   |  28 ++++++++++-----
 .travis.yml  |  10 +++---
 .verb.md     |   1 -
 README.md    |  29 +++++++++------
 index.js     |  25 ++++++-------
 package.json |  41 +++++++++++----------
 test.js      | 115 +++++++++++++++++++++++++++++------------------------------
 utils.js     |  19 ----------
 8 files changed, 134 insertions(+), 134 deletions(-)

diff --git a/.gitignore b/.gitignore
index 80a228c..0a16ee9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,15 +1,27 @@
+# always ignore files
 *.DS_Store
 *.sublime-*
-_gh_pages
-bower_components
+
+# test related, or directories generated by tests
+test/actual
+actual
+coverage
+.nyc*
+
+# npm
 node_modules
 npm-debug.log
-actual
-test/actual
+
+# yarn
+yarn.lock
+yarn-error.log
+
+# misc
+_gh_pages
+_draft
+_drafts
+bower_components
+vendor
 temp
 tmp
 TODO.md
-vendor
-.idea
-benchmark
-coverage
diff --git a/.travis.yml b/.travis.yml
index 3932eaa..3b07618 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,14 +1,16 @@
 sudo: false
+os:
+  - linux
+  - osx
 language: node_js
 node_js:
+  - node
+  - '7'
   - '6'
   - '5'
   - '4'
   - '0.12'
   - '0.10'
 matrix:
+  allow_failures: []
   fast_finish: true
-  allow_failures:
-    - node_js: '4'
-    - node_js: '0.10'
-    - node_js: '0.12'
diff --git a/.verb.md b/.verb.md
index 059265d..e5f1851 100644
--- a/.verb.md
+++ b/.verb.md
@@ -1,4 +1,3 @@
-{{#block "logo"}}{{/block}}
 ## Usage
 
 ```js
diff --git a/README.md b/README.md
index e2cb02d..c4da3f1 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-# 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)
+# collection-visit [![NPM version](https://img.shields.io/npm/v/collection-visit.svg?style=flat)](https://www.npmjs.com/package/collection-visit) [![NPM monthly downloads](https://img.shields.io/npm/dm/collection-visit.svg?style=flat)](https://npmjs.org/package/collection-visit)  [![NPM total downloads](https://img.shields.io/npm/dt/collection-visit.svg?style=flat)](https://npmjs.org/package/collection-visit) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/collection-v [...]
 
-Visit a method over the items in an object, or map visit over the objects in an array.
+> Visit a method over the items in an object, or map visit over the objects in an array.
 
 ## Install
 
@@ -47,22 +47,29 @@ console.log(ctx.data);
 
 Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
 
+### Contributors
+
+| **Commits** | **Contributor** | 
+| --- | --- |
+| 13 | [jonschlinkert](https://github.com/jonschlinkert) |
+| 9 | [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
@@ -70,13 +77,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/collection-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
diff --git a/index.js b/index.js
index a431d51..d1977ab 100644
--- a/index.js
+++ b/index.js
@@ -1,33 +1,30 @@
 /*!
  * collection-visit <https://github.com/jonschlinkert/collection-visit>
  *
- * Copyright (c) 2015, Jon Schlinkert.
- * Licensed under the MIT License.
+ * Copyright (c) 2015, 2017, Jon Schlinkert.
+ * Released under the MIT License.
  */
 
 'use strict';
 
-var utils = require('./utils');
+var visit = require('object-visit');
+var mapVisit = require('map-visit');
 
-function collectionVisit(collection, method, val) {
+module.exports = function(collection, method, val) {
   var result;
 
   if (typeof val === 'string' && (method in collection)) {
-    result = collection[method](val);
+    var args = [].slice.call(arguments, 2);
+    result = collection[method].apply(collection, args);
   } else if (Array.isArray(val)) {
-    result = utils.mapVisit(collection, method, val);
+    result = mapVisit.apply(null, arguments);
   } else {
-    result = utils.visit(collection, method, val);
+    result = visit.apply(null, arguments);
   }
 
   if (typeof result !== 'undefined') {
     return result;
   }
-  return collection;
-}
-
-/**
- * Expose `collectionVisit`
- */
 
-module.exports = collectionVisit;
+  return collection;
+};
diff --git a/package.json b/package.json
index b5936d4..fea9053 100644
--- a/package.json
+++ b/package.json
@@ -1,17 +1,20 @@
 {
   "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",
+  "version": "1.0.0",
   "homepage": "https://github.com/jonschlinkert/collection-visit",
   "author": "Jon Schlinkert (https://github.com/jonschlinkert)",
+  "contributors": [
+    "Brian Woodward <brian.woodward at gmail.com> (https://twitter.com/doowb)",
+    "Jon Schlinkert <jon.schlinkert at sellside.com> (http://twitter.com/jonschlinkert)"
+  ],
   "repository": "jonschlinkert/collection-visit",
   "bugs": {
     "url": "https://github.com/jonschlinkert/collection-visit/issues"
   },
   "license": "MIT",
   "files": [
-    "index.js",
-    "utils.js"
+    "index.js"
   ],
   "main": "index.js",
   "engines": {
@@ -20,23 +23,10 @@
   "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",
+    "collection",
     "context",
     "function",
     "helper",
@@ -54,8 +44,8 @@
     "related": {
       "list": [
         "base-methods",
-        "object-visit",
-        "map-visit"
+        "map-visit",
+        "object-visit"
       ]
     },
     "toc": false,
@@ -73,5 +63,18 @@
       "verb",
       "verb-generate-readme"
     ]
+  },
+  "dependencies": {
+    "map-visit": "^1.0.0",
+    "object-visit": "^1.0.0"
+  },
+  "devDependencies": {
+    "clone-deep": "^0.2.4",
+    "gulp": "^3.9.1",
+    "gulp-eslint": "^3.0.1",
+    "gulp-format-md": "^0.1.12",
+    "gulp-istanbul": "^1.1.1",
+    "gulp-mocha": "^3.0.0",
+    "mocha": "^3.2.0"
   }
 }
diff --git a/test.js b/test.js
index 1c9ad30..2fbd801 100644
--- a/test.js
+++ b/test.js
@@ -1,91 +1,90 @@
 'use strict';
 
 require('mocha');
-require('should');
 var assert = require('assert');
+var clone = require('clone-deep');
 var visit = require('./');
+var ctx;
 
-describe('arrays', function() {
-  var ctx = {
+describe('collection-visit', function() {
+  var fixture = {
+    options: {},
     data: {},
     set: function(key, value) {
-      if (Array.isArray(key)) {
-        visit(ctx, 'set', key);
-      } else if (typeof key === 'object') {
-        visit(ctx, 'set', key);
+      if (typeof key !== 'string') {
+        visit(this, 'set', key, value);
       } else {
-        ctx.data[key] = value;
+        this.data[key] = value;
       }
     }
   };
 
-  describe('visit', function() {
-    it('should call visit on every value in the given object:', function() {
-      ctx.set('a', 'a');
-      ctx.set([{b: 'b'}, {c: 'c'}]);
-      ctx.set({d: {e: 'f'}});
-      ctx.data.should.eql({
-        a: 'a',
-        b: 'b',
-        c: 'c',
-        d: { e: 'f' }
+  beforeEach(function() {
+    ctx = clone(fixture);
+  });
+
+  describe('arrays', function() {
+    describe('visit', function() {
+      it('should call visit on every value in the given object:', function() {
+        ctx.set('a', 'a');
+        ctx.set([{b: 'b'}, {c: 'c'}]);
+        ctx.set({d: {e: 'f'}});
+        assert.deepEqual(ctx.data, {
+          a: 'a',
+          b: 'b',
+          c: 'c',
+          d: { e: 'f' }
+        });
+      });
+
+      it('should pass the second argument to set:', function() {
+        ctx.set(['a', 'b'], function() {});
+        assert.equal(typeof ctx.data.a, 'function');
+        assert.equal(typeof ctx.data.b, 'function');
       });
-    });
 
-    it('should work when the value is a string:', function() {
-      ctx.setName = function(str) {
-        this.name = str;
-      };
+      it('should work when the value is a string:', function() {
+        ctx.setName = function(str) {
+          this.name = str;
+        };
 
-      visit(ctx, 'setName', 'foo');
-      assert(ctx.name);
-      assert(ctx.name === 'foo');
+        visit(ctx, 'setName', 'foo');
+        assert.equal(ctx.name, 'foo');
+      });
     });
   });
-});
 
-describe('objects', function() {
-  var obj = {
-    a: 'a',
-    b: 'b',
-    c: 'c',
-    d: { e: 'f' }
-  };
+  describe('objects', function() {
+    describe('visit', function() {
+      it('should call visit on every value in the given object:', function() {
+        ctx.set('a', 'a');
+        ctx.set('b', 'b');
+        ctx.set('c', 'c');
+        ctx.set({d: {e: 'f'}});
 
-  var ctx = {
-    data: {},
-    set: function(key, value) {
-      if (typeof key === 'object') {
-        visit(ctx, 'set', key);
-      } else {
-        ctx.data[key] = value;
-      }
-    }
-  };
-
-  describe('visit', function() {
-    it('should call visit on every value in the given object:', function() {
-      ctx.set('a', 'a');
-      ctx.set('b', 'b');
-      ctx.set('c', 'c');
-      ctx.set({d: {e: 'f'}});
-      ctx.data.should.eql(obj);
+        assert.deepEqual(ctx.data, {
+          a: 'a',
+          b: 'b',
+          c: 'c',
+          d: { e: 'f' }
+        });
+      });
     });
   });
 
   describe('errors', function() {
     it('should throw an error when invalid args are passed:', function() {
-      (function() {
+      assert.throws(function() {
         visit();
-      }).should.throw('object-visit expects `thisArg` to be an object.');
+      });
 
-      (function() {
+      assert.throws(function() {
         visit('foo', 'bar');
-      }).should.throw('object-visit expects `thisArg` to be an object.');
+      });
 
-      (function() {
+      assert.throws(function() {
         visit({}, {}, {});
-      }).should.throw('object-visit expects `method` name to be a string');
+      });
     });
   });
 });
diff --git a/utils.js b/utils.js
deleted file mode 100644
index f619e89..0000000
--- a/utils.js
+++ /dev/null
@@ -1,19 +0,0 @@
-'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;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-collection-visit.git



More information about the Pkg-javascript-commits mailing list