yearly
Year utility to test or bump year in a string. Useful for keeping license files up to date.
npm install yearly
const yearly =
API
yearly.bump(content)
Replace any years in content
with the current year. Uses yearly.express
and yearly.full
yearly // "2018"yearly // "2018 4ever"yearly // "2018 2018"yearly // "Copyright (c) 2018 Mickey Mouse"
yearly.test(content)
Test if content
contains current year. Uses yearly.express
and yearly.full
yearly // trueyearly // false
yearly.express(year)
Create regex for year
string. Uses word boundary in expression
yearly // /\b1999\b/g
yearly.full()
Get the full current local year string
yearly // "2018"
node
test
if license has current year
npm install yearly --save-dev
const fs = const yearly = const assert = assert
bump
license file
npm install edit-file yearly --save-dev
const editFile = const yearly =
git diff
npm test
logs bump examples
node test
Testing...
0 => 2018
2000 => 2018
-0 => -2018
0- => 2018-
4747474747 => 2018
02018 => 2018
20182018 => 2018
2000 8000 => 2018 2018
2000.8000 => 2018.2018
2000,8000 => 2018,2018
2000-8000 => 2018-2018
B2B => B2B
9999 4EVER => 2018 4EVER
2000_8000 => 2000_8000
2000x8000 => 2000x8000
Copyright (c) 1999 Mickey Mouse => Copyright (c) 2018 Mickey Mouse
Copyright (c) 1999 Mickey Mouse => Copyright (c) 2018 Mickey Mouse
Copyright (c) 1999, Mickey Mouse => Copyright (c) 2018, Mickey Mouse
Tests passed :)