npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

exclude-match

v1.0.7

Published

Exclude array items matching a given pattern.

Downloads

144

Readme

exclude-match npm version Build Status

Exclude items in an array matching a given pattern.

Install with npm:

$ npm install --save exclude-match

Usage

var exclude = require('exclude-match');
exclude(array, patternOrPatterns [, micromatchOptions]);

Strings and Arrays

// match single strings...
var array1 = exclude(['a', 'b', 'c'], 'a');
// ['b', 'c']

// or array of strings
var array2 = exclude(['a', 'b', 'c'], ['a', 'b']);
// ['c']

Globs

// match globs, and ignore case...
var array3 = exclude(['a.txt', 'B.txt', 'C.txt'], '*.txt', {nocase: true});
// ['a.txt', 'B.txt', 'C.txt']

// or array of globs
var array4 = exclude(['a.txt', 'b.json', 'c.js', 'd.txt'], ['*.{js,json}', '!*.txt']);
// ['b.json', 'c.js']

Numbers

// works with numbers too...
var array5 = exclude([1, 2, 3, 4, 5], 4);
// [1, 2, 3, 5]

// and glob matches...
var array6 = exclude([1, 2, 3, 4, 5], '{1...4}');
// [5]

// and even an array of globs
var array7 = exclude([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], ['{1...4}', '!{2..3}']);
// [2, 3, 5, 6, 7, 8, 9, 10]
  • array {Array}: Array to remove a matched item(s) from.
  • pattern {Number|String|Array}: Glob pattern(s) to match against.
  • options.nocase {Boolean}: Set this to true force case-insensitive filename checks. This is useful on case sensitive file systems.
  • returns {Array}: Returns the resolved array with removed matches if they exist, otherwise returns the original array.

Running tests

Install dev dependencies:

$ npm install -d && npm test

Contributing

Take care to maintain the existing coding style. Add unit tests for any new or changed functionality.

For bugs or feature requests, please create an issue.

Release History

2016-10-09 - v1.0.7 - Patch fixes.
2016-10-09 - v1.0.6 - Patch fixes.
2016-10-06 - v1.0.5 - Modified CI build config.
2016-10-06 - v1.0.4 - Added LICENSE.
2016-10-05 - v1.0.1 - Added build status to README.
2016-10-05 - v1.0.0 - Updated README.md. Added CI file for passing builds.
2016-10-03 - v0.2.0 - Updated dependencies. Reinforced type-checks.
2016-10-01 - v0.1.0 - Initial release.

Author

License

Copyright © 2016, "Captain" Morgan Worrell.
Released under the MIT license.