8889841ctest/strings.js000066600000003403150541240120007550 0ustar00var test = require('tape'), wildcard = require('../'); test('general wild card matching tests', function(t) { t.plan(8); t.ok(wildcard('*', 'test'), '* should match test'); t.ok(wildcard('foo.*', 'foo.bar'), 'foo.* should match foo.bar'); t.ok(wildcard('foo.*', 'foo'), 'foo.* should match foo'); t.ok(wildcard('*.foo.com', 'test.foo.com'), 'test.foo.com should match *.foo.com'); t.notOk(wildcard('foo.*', 'bar'), 'foo.* should not match bar'); t.ok(wildcard('a.*.c', 'a.b.c'), 'a.*.c should match a.b.c'); t.notOk(wildcard('a.*.c', 'a.b'), 'a.*.c should not match a.b'); t.notOk(wildcard('a', 'a.b.c'), 'a should not match a.b.c'); }); test('regex wildcard matching tests', function(t) { t.plan(4); t.ok(wildcard('*foo', 'foo'), '*foo should match foo'); t.ok(wildcard('*foo.b', 'foo.b'), '*foo.b should match foo.b'); t.ok(wildcard('a.*foo.c', 'a.barfoo.c'), 'a.barfoo.c should match a.*foo.c'); t.ok(wildcard('a.foo*.c', 'a.foobar.c'), 'a.foobar.c should match a.foo*.c'); }); test('general wild card with separator matching tests', function(t) { t.plan(5); t.ok(wildcard('foo:*', 'foo:bar', ':'), 'foo:* should match foo:bar'); t.ok(wildcard('foo:*', 'foo', ':'), 'foo:* should match foo'); t.notOk(wildcard('foo:*', 'bar', ':'), 'foo:* should not match bar'); t.ok(wildcard('a:*:c', 'a:b:c', ':'), 'a:*:c should match a:b:c'); t.notOk(wildcard('a:*:c', 'a:b', ':'), 'a:*:c should not match a:b'); }); test('general wild card with tokens being returned', function(t) { t.plan(5); var parts = wildcard('foo.*', 'foo.bar'); t.ok(parts); t.equal(parts.length, 2); t.equal(parts[0], 'foo'); t.equal(parts[1], 'bar'); parts = wildcard('foo.*', 'not.matching'); t.notOk(parts); }); test/objects.js000066600000005161150541240120007513 0ustar00var wildcard = require('../'), test = require('tape'), testdata = { 'a.b.c' : {}, 'a.b' : {}, 'a' : {}, 'a.b.d' : {} }, testdataSep = { 'a:b:c' : {}, 'a:b' : {}, 'a' : {}, 'a:b:d' : {} }; test('object result matching tests', function(t) { t.test('should return 4 matches for a.*', function(t) { var matches = wildcard('a.*', testdata); t.plan(4); t.ok(matches['a.b.c']); t.ok(matches['a.b']); t.ok(matches['a']); t.ok(matches['a.b.d']); t.end(); }); t.test('should return 4 matches for a:*', function(t) { var matches = wildcard('a:*', testdataSep, ':'); t.plan(4); t.ok(matches['a:b:c']); t.ok(matches['a:b']); t.ok(matches['a']); t.ok(matches['a:b:d']); t.end(); }); t.test('should return 3 matches for a.b.*', function(t) { var matches = wildcard('a.b.*', testdata); t.plan(4); t.ok(matches['a.b.c']); t.ok(matches['a.b']); t.notOk(matches['a']); t.ok(matches['a.b.d']); t.end(); }); t.test('should return 3 matches for a:b:*', function(t) { var matches = wildcard('a:b:*', testdataSep, ':'); t.plan(4); t.ok(matches['a:b:c']); t.ok(matches['a:b']); t.notOk(matches['a']); t.ok(matches['a:b:d']); t.end(); }); t.test('should return 1 matches for a.*.c', function(t) { var matches = wildcard('a.*.c', testdata); t.plan(4); t.ok(matches['a.b.c']); t.notOk(matches['a.b']); t.notOk(matches['a']); t.notOk(matches['a.b.d']); t.end(); }); t.test('should return 1 matches for a:*:c', function(t) { var matches = wildcard('a:*:c', testdataSep, ':'); t.plan(4); t.ok(matches['a:b:c']); t.notOk(matches['a:b']); t.notOk(matches['a']); t.notOk(matches['a:b:d']); t.end(); }); t.test('should return 0 matches for b.*.d', function(t) { var matches = wildcard('b.*.d', testdata); t.plan(4); t.notOk(matches['a.b.c']); t.notOk(matches['a.b']); t.notOk(matches['a']); t.notOk(matches['a.b.d']); t.end(); }); t.test('should return 0 matches for b:*:d', function(t) { var matches = wildcard('b:*:d', testdataSep, ':'); t.plan(4); t.notOk(matches['a:b:c']); t.notOk(matches['a:b']); t.notOk(matches['a']); t.notOk(matches['a:b:d']); t.end(); }); t.end(); }); test/all.js000066600000000100150541240120006616 0ustar00require('./arrays'); require('./objects'); require('./strings');test/arrays.js000066600000001727150541240120007367 0ustar00var test = require('tape'), wildcard = require('../'), testdata = [ 'a.b.c', 'a.b', 'a', 'a.b.d' ], testdataSep = [ 'a:b:c', 'a:b', 'a', 'a:b:d' ]; test('array result matching tests', function(t) { t.plan(5); t.equal(wildcard('*', testdata).length, 4, '* matches all testdata'); t.equal(wildcard('a.*', testdata).length, 4, '4 matches found'); t.equal(wildcard('a.b.*', testdata).length, 3, '3 matches found'); t.equal(wildcard('a.*.c', testdata).length, 1); t.equal(wildcard('b.*.d', testdata).length, 0); }); test('array result with separator matching tests', function(t) { t.plan(4); t.equal(wildcard('a:*', testdataSep, ':').length, 4, '4 matches found'); t.equal(wildcard('a:b:*', testdataSep, ':').length, 3, '3 matches found'); t.equal(wildcard('a:*:c', testdataSep, ':').length, 1); t.equal(wildcard('b:*:d', testdataSep, ':').length, 0); }); index.js000066600000005211150541240120006206 0ustar00/* jshint node: true */ 'use strict'; var REGEXP_PARTS = /(\*|\?)/g; /** # wildcard Very simple wildcard matching, which is designed to provide the same functionality that is found in the [eve](https://github.com/adobe-webplatform/eve) eventing library. ## Usage It works with strings: <<< examples/strings.js Arrays: <<< examples/arrays.js Objects (matching against keys): <<< examples/objects.js ## Alternative Implementations - Great for full file-based wildcard matching. - A well cared for and loved JS wildcard matcher. **/ function WildcardMatcher(text, separator) { this.text = text = text || ''; this.hasWild = text.indexOf('*') >= 0; this.separator = separator; this.parts = text.split(separator).map(this.classifyPart.bind(this)); } WildcardMatcher.prototype.match = function(input) { var matches = true; var parts = this.parts; var ii; var partsCount = parts.length; var testParts; if (typeof input == 'string' || input instanceof String) { if (!this.hasWild && this.text != input) { matches = false; } else { testParts = (input || '').split(this.separator); for (ii = 0; matches && ii < partsCount; ii++) { if (parts[ii] === '*') { continue; } else if (ii < testParts.length) { matches = parts[ii] instanceof RegExp ? parts[ii].test(testParts[ii]) : parts[ii] === testParts[ii]; } else { matches = false; } } // If matches, then return the component parts matches = matches && testParts; } } else if (typeof input.splice == 'function') { matches = []; for (ii = input.length; ii--; ) { if (this.match(input[ii])) { matches[matches.length] = input[ii]; } } } else if (typeof input == 'object') { matches = {}; for (var key in input) { if (this.match(key)) { matches[key] = input[key]; } } } return matches; }; WildcardMatcher.prototype.classifyPart = function(part) { // in the event that we have been provided a part that is not just a wildcard // then turn this into a regular expression for matching purposes if (part === '*') { return part; } else if (part.indexOf('*') >= 0 || part.indexOf('?') >= 0) { return new RegExp(part.replace(REGEXP_PARTS, '\.$1')); } return part; }; module.exports = function(text, test, separator) { var matcher = new WildcardMatcher(text, separator || /[\/\.]/); if (typeof test != 'undefined') { return matcher.match(test); } return matcher; }; README.md000066600000005110150541240120006016 0ustar00 # wildcard Very simple wildcard matching, which is designed to provide the same functionality that is found in the [eve](https://github.com/adobe-webplatform/eve) eventing library. [![NPM](https://nodei.co/npm/wildcard.png)](https://nodei.co/npm/wildcard/) [![Build Status](https://api.travis-ci.org/DamonOehlman/wildcard.svg?branch=master)](https://travis-ci.org/DamonOehlman/wildcard) [![stable](https://img.shields.io/badge/stability-stable-green.svg)](https://github.com/dominictarr/stability#stable) ## NOTE Work on this project is largely inactive, now so I'd recommend checking out the wonderful [`matcher`](https://github.com/sindresorhus/matcher) package as a solid alternative. ## Usage It works with strings: ```js var wildcard = require('wildcard'); console.log(wildcard('foo.*', 'foo.bar')); // --> true console.log(wildcard('foo.*', 'foo')); // --> true ``` Arrays: ```js var wildcard = require('wildcard'); var testdata = [ 'a.b.c', 'a.b', 'a', 'a.b.d' ]; console.log(wildcard('a.b.*', testdata)); // --> ['a.b.c', 'a.b', 'a.b.d'] ``` Objects (matching against keys): ```js var wildcard = require('wildcard'); var testdata = { 'a.b.c' : {}, 'a.b' : {}, 'a' : {}, 'a.b.d' : {} }; console.log(wildcard('a.*.c', testdata)); // --> { 'a.b.c': {} } ``` ## Alternative Implementations - Great for full file-based wildcard matching. - A well cared for and loved JS wildcard matcher. ## License(s) ### MIT Copyright (c) 2017 Damon Oehlman 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. docs.json000066600000000153150541240120006364 0ustar00{ "badges": { "nodeico": true, "travis": true, "stability": "stable" }, "license": {} } yarn.lock000066600000021740150541240120006371 0ustar00# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 balanced-match@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.0.tgz#89b4d199ab2bee49de164ea02b89ce462d71b767" integrity sha1-ibTRmasr7kneFk6gK4nORi1xt2c= brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA== dependencies: balanced-match "^1.0.0" concat-map "0.0.1" concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= deep-equal@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.0.1.tgz#f5d260292b660e084eff4cdbc9f08ad3247448b5" integrity sha1-9dJgKStmDghO/0zbyfCK0yR0SLU= define-properties@^1.1.2: version "1.1.3" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.3.tgz#cf88da6cbee26fe6db7094f61d870cbd84cee9f1" integrity sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ== dependencies: object-keys "^1.0.12" defined@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/defined/-/defined-1.0.0.tgz#c98d9bcef75674188e110969151199e39b1fa693" integrity sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM= es-abstract@^1.5.0: version "1.13.0" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.13.0.tgz#ac86145fdd5099d8dd49558ccba2eaf9b88e24e9" integrity sha512-vDZfg/ykNxQVwup/8E1BZhVzFfBxs9NqMzGcvIJrqg5k2/5Za2bWo40dK2J1pgLngZ7c+Shh8lwYtLGyrwPutg== dependencies: es-to-primitive "^1.2.0" function-bind "^1.1.1" has "^1.0.3" is-callable "^1.1.4" is-regex "^1.0.4" object-keys "^1.0.12" es-to-primitive@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.0.tgz#edf72478033456e8dda8ef09e00ad9650707f377" integrity sha512-qZryBOJjV//LaxLTV6UC//WewneB3LcXOL9NP++ozKVXsIIIpm/2c13UDiD9Jp2eThsecw9m3jPqDwTyobcdbg== dependencies: is-callable "^1.1.4" is-date-object "^1.0.1" is-symbol "^1.0.2" for-each@~0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/for-each/-/for-each-0.3.3.tgz#69b447e88a0a5d32c3e7084f3f1710034b21376e" integrity sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw== dependencies: is-callable "^1.1.3" fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8= function-bind@^1.0.2, function-bind@^1.1.1, function-bind@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== glob@~7.1.4: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" integrity sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" inherits "2" minimatch "^3.0.4" once "^1.3.0" path-is-absolute "^1.0.0" has-symbols@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.0.tgz#ba1a8f1af2a0fc39650f5c850367704122063b44" integrity sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q= has@^1.0.1, has@^1.0.3, has@~1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796" integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw== dependencies: function-bind "^1.1.1" inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk= dependencies: once "^1.3.0" wrappy "1" inherits@2, inherits@~2.0.3: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== is-callable@^1.1.3, is-callable@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.4.tgz#1e1adf219e1eeb684d691f9d6a05ff0d30a24d75" integrity sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA== is-date-object@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.1.tgz#9aa20eb6aeebbff77fbd33e74ca01b33581d3a16" integrity sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY= is-regex@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" integrity sha1-VRdIm1RwkbCTDglWVM7SXul+lJE= dependencies: has "^1.0.1" is-symbol@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" integrity sha512-HS8bZ9ox60yCJLH9snBpIwv9pYUAkcuLhSA1oero1UB5y9aiQpRA8y2ex945AOtCZL1lJDeIk3G5LthswI46Lw== dependencies: has-symbols "^1.0.0" minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== dependencies: brace-expansion "^1.1.7" minimist@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= object-inspect@~1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.6.0.tgz#c70b6cbf72f274aab4c34c0c82f5167bf82cf15b" integrity sha512-GJzfBZ6DgDAmnuaM3104jR4s1Myxr3Y3zfIyN4z3UdqN69oSRacNK8UhnobDdC+7J2AHCjGwxQubNJfE70SXXQ== object-keys@^1.0.12: version "1.1.1" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" integrity sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA== once@^1.3.0: version "1.4.0" resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= dependencies: wrappy "1" path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18= path-parse@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" integrity sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw== resolve@~1.10.1: version "1.10.1" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.1.tgz#664842ac960795bbe758221cdccda61fb64b5f18" integrity sha512-KuIe4mf++td/eFb6wkaPbMDnP6kObCaEtIDuHOUED6MNUo4K670KZUHuuvYPZDxNF0WVLw49n06M2m2dXphEzA== dependencies: path-parse "^1.0.6" resumer@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/resumer/-/resumer-0.0.0.tgz#f1e8f461e4064ba39e82af3cdc2a8c893d076759" integrity sha1-8ej0YeQGS6Oegq883CqMiT0HZ1k= dependencies: through "~2.3.4" string.prototype.trim@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.1.2.tgz#d04de2c89e137f4d7d206f086b5ed2fae6be8cea" integrity sha1-0E3iyJ4Tf019IG8Ia17S+ua+jOo= dependencies: define-properties "^1.1.2" es-abstract "^1.5.0" function-bind "^1.0.2" tape@^4.6.3: version "4.10.2" resolved "https://registry.yarnpkg.com/tape/-/tape-4.10.2.tgz#129fcf62f86df92687036a52cce7b8ddcaffd7a6" integrity sha512-mgl23h7W2yuk3N85FOYrin2OvThTYWdwbk6XQ1pr2PMJieyW2FM/4Bu/+kD/wecb3aZ0Enm+Syinyq467OPq2w== dependencies: deep-equal "~1.0.1" defined "~1.0.0" for-each "~0.3.3" function-bind "~1.1.1" glob "~7.1.4" has "~1.0.3" inherits "~2.0.3" minimist "~1.2.0" object-inspect "~1.6.0" resolve "~1.10.1" resumer "~0.0.0" string.prototype.trim "~1.1.2" through "~2.3.8" through@~2.3.4, through@~2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU= wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= .travis.yml000066600000000147150541240120006655 0ustar00language: node_js node_js: - 10 - 11 - 12 notifications: email: - damon.oehlman@gmail.com examples/strings.js000066600000000212150541240120010402 0ustar00var wildcard = require('..'); console.log(wildcard('foo.*', 'foo.bar')); // --> true console.log(wildcard('foo.*', 'foo')); // --> true examples/objects.js000066600000000263150541240120010350 0ustar00var wildcard = require('..'); var testdata = { 'a.b.c' : {}, 'a.b' : {}, 'a' : {}, 'a.b.d' : {} }; console.log(wildcard('a.*.c', testdata)); // --> { 'a.b.c': {} } examples/arrays.js000066600000000243150541240120010216 0ustar00var wildcard = require('..'); var testdata = [ 'a.b.c', 'a.b', 'a', 'a.b.d' ]; console.log(wildcard('a.b.*', testdata)); // --> ['a.b.c', 'a.b', 'a.b.d'] package.json000066600000001670150541240120007034 0ustar00{ "name": "wildcard", "description": "Wildcard matching tools", "author": "Damon Oehlman ", "keywords": [ "string", "wildcard" ], "version": "2.0.0", "dependencies": {}, "devDependencies": { "tape": "^4.6.3" }, "testling": { "files": "test/all.js", "browsers": { "ie": [ "latest" ], "ff": [ "latest", "nightly" ], "chrome": [ "latest", "canary" ], "opera": [ "latest", "next" ], "safari": [ "latest" ] } }, "repository": { "type": "git", "url": "git://github.com/DamonOehlman/wildcard.git" }, "bugs": { "url": "http://github.com/DamonOehlman/wildcard/issues" }, "scripts": { "test": "node test/all.js", "gendocs": "gendocs > README.md" }, "main": "index.js", "directories": { "test": "test" }, "license": "MIT" }