
Product
Socket Now Supports pylock.toml Files
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
chainsmoker
Advanced tools
Elegant, generically typed, boolean micromatch for lists of file paths
Elegant, generically typed, boolean micromatch for lists of file paths in TypeScript.
.filter()
and .length
.I'm pleased to say as of Danger.js 7.1, this helper is vendored into
Danger and accessible as danger.fileMatch
.
const { danger, fail, message, warn } = require('danger')
const chainsmoker = require('chainsmoker')
// In this example, these are all arrays of relative paths.
const fileMatch = chainsmoker({
created: danger.git.created_files,
modified: danger.git.modified_files,
updated: danger.git.modified_files.concat(danger.git.created_files),
deleted: danger.git.deleted_files,
})
const documentation = fileMatch(
'**/*.md',
'lib/all-badge-examples.js',
'frontend/components/usage.js'
)
const packageJson = fileMatch('package.json')
const packageLock = fileMatch('package-lock.json')
const helpers = fileMatch('lib/**/*.js', '!**.spec.js')
const helperTests = fileMatch('lib/**/*.spec.js')
// This is `true` whenever there are matches in the corresponding path array.
if (documentation.updated) {
message('We :heart: our [documentarians](http://www.writethedocs.org/)!')
}
if (packageJson.modified && !packageLock.modified) {
warn('This PR modified package.json, but not package-lock.json')
}
if (helpers.created && !helperTests.created) {
warn('This PR added helper modules in lib/ but not accompanying tests.')
} else if (helpers.updated && !helperTests.updated) {
warn('This PR modified helper modules in lib/ but not accompanying tests.')
}
fileMatch.getKeyedPatterns()
Return an object containing arrays of matched files instead of the usual boolean values.
Requires Node 8+.
npm install --save-dev chainsmoker
Pull requests welcome!
If you are having issues, please let me know.
The name was inspired by the idea of a chainable file-set object using minimatch. It's also for Danger… maybe that was part of the inspiration.
I ended up with something simpler that doesn't rely on chaining, though I kept the name.
Thanks to @orta for reviewing this and shipping it with Danger.
The project is licensed under the MIT license.
1.0.3
FAQs
Elegant, generically typed, boolean micromatch for lists of file paths
The npm package chainsmoker receives a total of 1 weekly downloads. As such, chainsmoker popularity was classified as not popular.
We found that chainsmoker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.
Research
Security News
Malicious Ruby gems typosquat Fastlane plugins to steal Telegram bot tokens, messages, and files, exploiting demand after Vietnam’s Telegram ban.