Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Burkes committed Apr 29, 2018
0 parents commit 1a3b3bf
Show file tree
Hide file tree
Showing 16 changed files with 2,569 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"presets": [
"babel-preset-env"
]
}
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/dist/**
/bin/**
13 changes: 13 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"parser": "babel-eslint",
"extends": "eslint:recommended",
"env": {
"es6": true,
"browser": true,
"node": true,
"mocha": true
},
"rules": {
"no-console": 0
}
}
68 changes: 68 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# TypeScript v1 declaration files
typings/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# next.js build output
.next

# build output does not go to the repository
dist/

# lockfiles
package-lock.json
yarn.lock
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
language: node_js
script:
- "npm test"
node_js:
- "stable"
- "8"
- "6"
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 @Burkes

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# [gfynonce](https://burkes.github.io/gfynonce) - [![license](https://img.shields.io/github/license/Burkes/gfynonce.svg)](https://github.com/Burkes/gfynonce/blob/master/LICENSE) [![npm](https://img.shields.io/npm/v/gfynonce.svg)](https://npm.im/gfynonce) [![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/gfynonce.svg)](https://unpkg.com/gfynonce) [![Travis](https://img.shields.io/travis/Burkes/gfynonce.svg)](https://travis-ci.org/Burkes/gfynonce) ![node](https://img.shields.io/node/v/gfynonce.svg)

gfynonce is a "small" library that generates unique word compositions in the "adjective, adjective, animal" format that both Gfycat and Twitch uses. It tries it's best to generate nonces without repeating the same adjective and allows _some_ customization, such as providing the number of adjectives desired or the separator character.

## Installation and Usage

For your convenience, it is available in 3 forms, so choose whatever will work best for you:

### Command Line
Installing gfynonce for the command line is as simple as running the following command:
```
npm i -g gfynonce
```

Then, simply run `gfynonce` and it will generate a nonce with the default settings.
```
$ gfynonce
FatSmallAmericanBulldog
```
Additionally, you can provide some arguments to customize it, such as `--adjectives <number>` and `--separator <char>`.
```
$ gfynonce --adjectives 5 --separator .
Big.Small.Fancy.Elegant.Shy.Dipper
```

### Node
The installation procedure is almost the same, simply add it to your current project:
```
npm i --save gfynonce
```

And you should be good to import it!
```js
const gfynonce = require('gfynonce');

console.log(gfynonce({ adjectives: 1, separator: '_' }));
// Tiny_Hog
```

### Browser
Unpkg kindly provides a fast CDN for NPM packages which you can use to access the UMD script.
```html
<script src="https://unpkg.com/gfynonce@latest/dist/gfynonce.min.js"></script>
<script>
console.log(gfynonce());
// HugeSmallArthropods
</script>
```
12 changes: 12 additions & 0 deletions bin/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env node

// aiming for older node version compatibility

var gfynonce = require('../');
var minimist = require('minimist');

var argv = minimist(process.argv.slice(2));

var options = Object.assign({}, { separator: '', adjectives: 2 }, argv);

process.stdout.write(gfynonce(options));
Loading

0 comments on commit 1a3b3bf

Please sign in to comment.