-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move actual functionality into a lib * Add test * Add tap as devDependency * Make tests cover suffix generation * Added .travis.yml file * Added environment to .travis.yml file * Added tap to dependencies, removed env from .travis.yml * Fix package.json * misc fixes * We can run under an older node * Remove unused line * Misc fixes * Randomly add a suffix * Remove tap from dependencies * Removing travis (for now)
- Loading branch information
Showing
4 changed files
with
143 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
const first = [ | ||
'Candy', | ||
'Cotton', | ||
'Cross', | ||
'Deity', | ||
'Dropout', | ||
'Feed', | ||
'Fire', | ||
'Gopher', | ||
'Gourmet', | ||
'Halux', | ||
'Head', | ||
'Howler', | ||
'Irate', | ||
'Iron', | ||
'Jet', | ||
'Junior', | ||
'Loud', | ||
'Maestro', | ||
'Monkey', | ||
'Night', | ||
'Photo', | ||
'Rage', | ||
'School', | ||
'Sierra', | ||
'Somber', | ||
'Souffle', | ||
'Stucco', | ||
'Surly', | ||
'Swap', | ||
'Tawdry', | ||
'Tote', | ||
'Trinity', | ||
'Water', | ||
'Wistful' | ||
] | ||
|
||
const second = [ | ||
' CTX', | ||
' EBSR', | ||
'Anglo', | ||
'Auto', | ||
'Beam', | ||
'Bounce', | ||
'Calendar', | ||
'Chef', | ||
'Cyclone', | ||
'Entourage', | ||
'Genesis', | ||
'Ghostly', | ||
'Ginsu', | ||
'Gram', | ||
'Jeep', | ||
'Knave', | ||
'Maestro', | ||
'Master', | ||
'Mint', | ||
'Monk', | ||
'Monkey', | ||
'Montana', | ||
'Mouth', | ||
'Nebula', | ||
'Picasso', | ||
'Plow', | ||
'Set', | ||
'Sparrow', | ||
'Spawn', | ||
'Stand', | ||
'Swap', | ||
'Thorugh', | ||
'Toll', | ||
'Trinity', | ||
'Typhon', | ||
'Walk', | ||
'Watch', | ||
'Water', | ||
'Witch', | ||
'Yard' | ||
] | ||
|
||
const suffixes = ['HX', 'I', 'II', 'III', '4000', 'Hx9', '2.0'] | ||
|
||
/** | ||
* Returns a nice name for a secret project or tool. | ||
* | ||
* @return {string} | ||
*/ | ||
function getNSAName (suffix = false) { | ||
var nsaname = first[Math.floor(Math.random() * first.length)] + | ||
second[Math.floor(Math.random() * second.length)] | ||
|
||
if (suffix) { | ||
nsaname += ' ' + | ||
suffixes[Math.floor(Math.random() * suffixes.length)] | ||
} | ||
return nsaname | ||
} | ||
|
||
module.exports = { | ||
getNSAName: getNSAName, | ||
wordLists: { | ||
first: first, | ||
second: second, | ||
suffixes: suffixes | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,26 @@ | ||
{ | ||
"name": "nsaname", | ||
"version": "1.0.1", | ||
"description": "Like petname, but for naming secret projects and tools.", | ||
"main": "index.js", | ||
"author": "Ricardo Banffy <[email protected]>", | ||
"license": "Apache-2.0", | ||
"bin": { | ||
"nsaname": "index.js" | ||
}, | ||
"dependencies": { | ||
"command-line-args": ">=3.0.5", | ||
"command-line-usage": ">=3.0.0" | ||
}, | ||
"engines": { | ||
"node": ">=0.12.18" | ||
} | ||
"name": "nsaname", | ||
"version": "1.0.2", | ||
"description": "Like petname, but for naming secret projects and tools.", | ||
"main": "index.js", | ||
"author": "Ricardo Banffy <[email protected]>", | ||
"license": "Apache-2.0", | ||
"bin": { | ||
"nsaname": "index.js" | ||
}, | ||
|
||
"dependencies": { | ||
"command-line-args": ">=3.0.5", | ||
"command-line-usage": ">=3.0.0", | ||
}, | ||
"engines": { | ||
"node": ">=6.9.0" | ||
}, | ||
"repository": "https://github.com/rbanffy/nsaname.git", | ||
"devDependencies": { | ||
"tap": ">=8.0.1" | ||
}, | ||
"scripts": { | ||
"test": "tap test/*.js" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const tap = require('tap') | ||
const nsaname = require('../lib/nsaname.js') | ||
|
||
var name = nsaname.getNSAName() | ||
|
||
tap.true(nsaname.wordLists.first.some(function (n) { return name.indexOf(n) > -1 })) | ||
tap.true(nsaname.wordLists.second.some(function (n) { return name.indexOf(n) > -1 })) | ||
|
||
name = nsaname.getNSAName(true) | ||
|
||
tap.true(nsaname.wordLists.suffixes.some(function (n) { return name.indexOf(n) > -1 })) |