
Security News
npm ‘is’ Package Hijacked in Expanding Supply Chain Attack
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Small utility returning grunt file filter by last modified age
I described the motivation behind this little filter in Aged to Perfection blog post.
npm install aged --save-dev
function aged(n, units, verbose)
n - positive number
units - time units: 'days', 'hours', 'minutes', etc
verbose - print filename if file is too young
aged can be used to define different metrics to run on different files depending on their age. For example, to pass older, stable source files through static grunt-complexity plugin you can:
// Gruntfile.js
var aged = require('aged');
var files = ['Gruntfile.js', 'src/index.js'];
grunt.initConfig({
complexity: {
fresh: {
src: files,
options: {
cyclomatic: 5,
halstead: 10,
maintainability: 100
}
},
aged: {
src: files,
filter: aged(3, 'days', true),
options: {
errorsOnly: false,
cyclomatic: 2,
halstead: 10,
maintainability: 100
}
}
}
});
This will pass all files though less stringent fresh limits, while passing files older than 3 days though higher limits.
You can easily define the opposite filter to aged
function fresher(n, units) {
var isAged = aged(n, units);
return function (filename) {
return !isAged(filename);
};
}
Any time units are allowed, see momentjs docs.
Author: Gleb Bahmutov Copyright © 2013
License: MIT - do anything with the code, but don't blame me if it does not work.
Spread the word: tweet, star on github, etc.
Support: if you find any problems with this module, email / tweet / open issue on Github
FAQs
Small utility returning grunt file filter by last modified age
The npm package aged receives a total of 0 weekly downloads. As such, aged popularity was classified as not popular.
We found that aged 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.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.
Security News
A critical flaw in the popular npm form-data package could allow HTTP parameter pollution, affecting millions of projects until patched versions are adopted.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.