Comparing version 0.3.0 to 0.3.2
@@ -23,2 +23,16 @@ /*jslint node: true */ | ||
fullSourceDescription: true | ||
}, | ||
exec: { | ||
cover: { | ||
cmd: './node_modules/.bin/istanbul cover ./node_modules/.bin/grunt test' | ||
}, | ||
check_cover: { | ||
cmd: './node_modules/.bin/istanbul check-coverage --statement 100 --branch 100 --function 100 --line 100' | ||
}, | ||
coveralls: { | ||
cmd: 'cat coverage/lcov.info | coveralls' | ||
} | ||
} | ||
@@ -30,2 +44,3 @@ }); | ||
grunt.loadNpmTasks('grunt-apidox'); | ||
grunt.loadNpmTasks('grunt-exec'); | ||
@@ -35,3 +50,5 @@ grunt.registerTask('lint', 'jslint'); | ||
grunt.registerTask('docs', 'apidox'); | ||
grunt.registerTask('coverage', ['exec:cover', 'exec:check_cover']); | ||
grunt.registerTask('coveralls', 'exec:coveralls'); | ||
grunt.registerTask('default', ['jslint', 'cafemocha']); | ||
}; |
/** | ||
# qlobber [![Build Status](https://travis-ci.org/davedoesdev/qlobber.png)](https://travis-ci.org/davedoesdev/qlobber) | ||
# qlobber [![Build Status](https://travis-ci.org/davedoesdev/qlobber.png)](https://travis-ci.org/davedoesdev/qlobber) [![Coverage Status](https://coveralls.io/repos/davedoesdev/qlobber/badge.png?branch=master)](https://coveralls.io/r/davedoesdev/qlobber?branch=master) | ||
@@ -30,3 +30,3 @@ Node.js globbing for amqp-like topics. | ||
```javascript | ||
var matcher = new Qlobber({ remove_duplicates: true }); | ||
var matcher = new Qlobber(); | ||
matcher.add('*.orange.*', 'Q1'); | ||
@@ -78,2 +78,12 @@ matcher.add('*.*.rabbit', 'Q2'); | ||
## Code Coverage | ||
```javascript | ||
grunt coverage | ||
``` | ||
[Instanbul](http://gotwarlost.github.io/istanbul/) results are available [here](http://htmlpreview.github.io/?https://github.com/davedoesdev/qlobber/blob/master/coverage/lcov-report/index.html). | ||
Coveralls page is [here](https://coveralls.io/r/davedoesdev/qlobber). | ||
# API | ||
@@ -261,2 +271,3 @@ */ | ||
@param {Any} val The value to return if the topic is matched. `undefined` is not supported. | ||
@return {Qlobber} The qlobber (for chaining). | ||
*/ | ||
@@ -266,2 +277,3 @@ Qlobber.prototype.add = function (topic, val) | ||
this._add(val, 0, topic.split(this._separator), this._trie); | ||
return this; | ||
}; | ||
@@ -274,2 +286,3 @@ | ||
@param {Any} [val] The value that's being matched. If you don't specify `val` then all matchers for `topic` are removed. | ||
@return {Qlobber} The qlobber (for chaining). | ||
*/ | ||
@@ -284,2 +297,3 @@ Qlobber.prototype.remove = function (topic, val) | ||
this._remove(val, 0, topic.split(this._separator), this._trie); | ||
return this; | ||
}; | ||
@@ -291,3 +305,3 @@ | ||
@param {String} topic The topic to match against. | ||
@return {Array} List of values that matched the topic. This may contain duplicates if more than one matcher matches the topic with the same value. | ||
@return {Array} List of values that matched the topic. This may contain duplicates. | ||
*/ | ||
@@ -303,2 +317,4 @@ Qlobber.prototype.match = function (topic) | ||
Removes all topic matchers from the qlobber. | ||
@return {Qlobber} The qlobber (for chaining). | ||
*/ | ||
@@ -308,2 +324,3 @@ Qlobber.prototype.clear = function () | ||
this._trie = {}; | ||
return this; | ||
}; | ||
@@ -310,0 +327,0 @@ |
{ | ||
"name": "qlobber", | ||
"description": "Node.js globbing for amqp-like topics", | ||
"version": "0.3.0", | ||
"version": "0.3.2", | ||
"homepage": "https://github.com/davedoesdev/qlobber", | ||
@@ -26,3 +26,4 @@ "author": { | ||
"scripts": { | ||
"test": "grunt lint test" | ||
"test": "grunt lint test", | ||
"travis-test": "grunt lint test coverage coveralls" | ||
}, | ||
@@ -46,4 +47,7 @@ "directories": { | ||
"grunt-apidox": "~0.0.1", | ||
"chai": "~1.6.1" | ||
"chai": "~1.6.1", | ||
"istanbul": "~0.1.37", | ||
"grunt-exec": "~0.4.2", | ||
"coveralls": "~2.0.16" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# qlobber [![Build Status](https://travis-ci.org/davedoesdev/qlobber.png)](https://travis-ci.org/davedoesdev/qlobber) | ||
# qlobber [![Build Status](https://travis-ci.org/davedoesdev/qlobber.png)](https://travis-ci.org/davedoesdev/qlobber) [![Coverage Status](https://coveralls.io/repos/davedoesdev/qlobber/badge.png?branch=master)](https://coveralls.io/r/davedoesdev/qlobber?branch=master) | ||
@@ -29,3 +29,3 @@ Node.js globbing for amqp-like topics. | ||
```javascript | ||
var matcher = new Qlobber({ remove_duplicates: true }); | ||
var matcher = new Qlobber(); | ||
matcher.add('*.orange.*', 'Q1'); | ||
@@ -77,2 +77,12 @@ matcher.add('*.*.rabbit', 'Q2'); | ||
## Code Coverage | ||
```javascript | ||
grunt coverage | ||
``` | ||
[Instanbul](http://gotwarlost.github.io/istanbul/) results are available [here](http://htmlpreview.github.io/?https://github.com/davedoesdev/qlobber/blob/master/coverage/lcov-report/index.html). | ||
Coveralls page is [here](https://coveralls.io/r/davedoesdev/qlobber). | ||
# API | ||
@@ -120,2 +130,6 @@ | ||
**Return:** | ||
`{Qlobber}` The qlobber (for chaining). | ||
<sub>Go: [TOC](#tableofcontents) | [Qlobber.prototype](#toc_qlobberprototype)</sub> | ||
@@ -132,2 +146,6 @@ | ||
**Return:** | ||
`{Qlobber}` The qlobber (for chaining). | ||
<sub>Go: [TOC](#tableofcontents) | [Qlobber.prototype](#toc_qlobberprototype)</sub> | ||
@@ -145,3 +163,3 @@ | ||
`{Array}` List of values that matched the topic. This may contain duplicates if more than one matcher matches the topic with the same value. | ||
`{Array}` List of values that matched the topic. This may contain duplicates. | ||
@@ -156,4 +174,8 @@ <sub>Go: [TOC](#tableofcontents) | [Qlobber.prototype](#toc_qlobberprototype)</sub> | ||
**Return:** | ||
`{Qlobber}` The qlobber (for chaining). | ||
<sub>Go: [TOC](#tableofcontents) | [Qlobber.prototype](#toc_qlobberprototype)</sub> | ||
_—generated by [apidox](https://github.com/codeactual/apidox)—_ |
@@ -22,3 +22,3 @@ /*globals rabbitmq_test_bindings : false, | ||
{ | ||
matcher = new qlobber.Qlobber({ remove_duplicates: true }); | ||
matcher = new qlobber.Qlobber(); | ||
done(); | ||
@@ -182,3 +182,35 @@ }); | ||
}); | ||
it('should not remove anything if not previously added', function () | ||
{ | ||
matcher.add('foo.*', 'it matched!'); | ||
matcher.remove('foo'); | ||
matcher.remove('foo.*', 'something'); | ||
matcher.remove('bar.*'); | ||
expect(matcher.match('foo.bar')).to.eql(['it matched!']); | ||
}); | ||
it('should accept wildcards in match topics', function () | ||
{ | ||
matcher.add('foo.*', 'it matched!'); | ||
matcher.add('foo.#', 'it matched too!'); | ||
expect(matcher.match('foo.*').sort()).to.eql(['it matched too!', 'it matched!']); | ||
expect(matcher.match('foo.#').sort()).to.eql(['it matched too!', 'it matched!']); | ||
}); | ||
it('should be configurable', function () | ||
{ | ||
matcher = new qlobber.Qlobber({ | ||
separator: '/', | ||
wildcard_one: '+', | ||
wildcard_some: 'M' | ||
}); | ||
matcher.add('foo/+', 'it matched!'); | ||
matcher.add('foo/M', 'it matched too!'); | ||
expect(matcher.match('foo/bar').sort()).to.eql(['it matched too!', 'it matched!']); | ||
expect(matcher.match('foo/bar/end').sort()).to.eql(['it matched too!']); | ||
}); | ||
}); | ||
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
160562
20
644
176
9