UNPKG

@hankei6km/reposition

Version:

`reposition` is a command line tool to send a repository list to Notion database.

21 lines (20 loc) 594 B
export class Filter { opts; nowSec; constructor(opts) { this.opts = Object.assign({}, opts); this.nowSec = this.opts.now / 1000; } do(repo) { if (this.opts.filterTimeRange === 0) { return true; } const updatedAt = new Date(repo.updatedAt).getTime() / 1000; const pushedAt = new Date(repo.pushedAt).getTime() / 1000; if (this.nowSec - updatedAt < this.opts.filterTimeRange || this.nowSec - pushedAt < this.opts.filterTimeRange) { return true; } return false; } }