aged
Small utility returning grunt file filter by last modified age
Last updated 7 years ago by bahmutov .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install aged 
SYNC missed versions from official npm registry.

aged

Small utility returning grunt file filter by last modified age

NPM

Build status dependencies devdependencies

endorse

install

npm install aged --save-dev

use

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'),
            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.

advanced

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.

Small print

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

Current Tags

  • 0.0.1                                ...           latest (7 years ago)

2 Versions

  • 0.0.1                                ...           7 years ago
  • 0.0.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (3)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |