filter-changelog-paths

Extract CHANGELOG-like paths from multiple file paths

Usage no npm install needed!

<script type="module">
  import filterChangelogPaths from 'https://cdn.skypack.dev/filter-changelog-paths';
</script>

README

filter-changelog-paths

NPM version Build Status Build status Coverage Status Dependency Status devDependency Status

A Node module to extract CHANGELOG-like paths from multiple file paths

const filterChangelogPaths = require('filter-changelog-paths');

filterChangelogPaths([
  'CHANGELOG.txt',
  'CONTRIBUTING',
  'project/docs/release_notes.md',
  'lib/index.js'
]);
//=> ['CHANGELOG.txt', 'project/docs/release_notes.md']

Installation

Use npm.

npm install filter-changelog-paths

API

const filterChangelogPaths = require('filter-changelog-paths');

filterChangelogPaths(filePaths)

filePaths: Array of strings (file paths)
Return: Array of strings

It filters a given array by using is-changelog-path as a filter function.

const filterChangelogPaths = require('filter-changelog-paths');

filterChangelogPaths([]); //=> []

filterChangelogPaths('changelog'); // throws a type error
filterChangelogPaths(['changelog', 1, 'history', true]); // throws a type error
filterChangelogPaths(); // throws a type error

filterChangelogPaths.posix(filePaths)

filePaths: Array of strings (file paths)
Return: Array of strings

Always interact in a posix compatible way.

filterChangelogPaths.posix(['dir\\releases']); //=> []

filterChangelogPaths.win32(filePaths)

filePaths: Array of strings (file paths)
Return: Array of strings

Always interact in a win32 compatible way.

filterChangelogPaths.win32(['dir\\releases']); //=> ['dir\\releases']

License

Copyright (c) 2015 Shinnosuke Watanabe

Licensed under the MIT License.