├── .nvmrc ├── .gitignore ├── .travis.yml ├── src ├── index.js ├── index.test.js └── costelog.json ├── webpack.config.js ├── CONTRIBUTING.md ├── README.md └── package.json /.nvmrc: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | dist 4 | .nyc_output 5 | npm-debug.log 6 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: false 2 | language: node_js 3 | cache: 4 | directories: 5 | - node_modules 6 | branches: 7 | only: 8 | - master 9 | notifications: 10 | email: false 11 | node_js: 12 | - 4 13 | before_install: 14 | - npm i -g npm@^3.0.0 15 | before_script: 16 | - npm prune 17 | script: 18 | - npm run cover 19 | - npm run check-coverage 20 | - npm run build 21 | after_success: 22 | - npm run semantic-release 23 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var uniqueRandomArray = require('unique-random-array'); 4 | var costelog = require('./costelog.json'); 5 | 6 | var random = (name) => replaceName(name, uniqueRandomArray(costelog)()); 7 | var all = (name) => costelog.map((item) => replaceName(name, item)); 8 | 9 | function replaceName(name, item) { 10 | return item.replace(/#NAME{(.*?)}/, name || '$1').trim(); 11 | } 12 | 13 | module.exports = { 14 | random, 15 | all 16 | }; -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | context: __dirname, 3 | entry: './src/index', 4 | output: { 5 | path: './dist/', 6 | filename: 'index.js' 7 | }, 8 | 9 | module: { 10 | loaders: [ 11 | { 12 | test: /\.js$/, 13 | loader: 'babel', 14 | include: ['src'] 15 | }, 16 | { 17 | test: /\.json$/, 18 | loader: 'json', 19 | include: ['src'] 20 | }, 21 | ] 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | To contribute to the project, please follow these steps: 4 | 5 | 1. Get approval for the idea by filing an issue and talking with me about the changes. 6 | 2. Fork the repo 7 | 3. Make a branch for your change 8 | 4. Run `npm install` 9 | 5. Run `npm start` 10 | 6. Make your changes 11 | 7. Test your changes (we have a githook that disallows anything less than 100% code coverage) 12 | 8. Run `git add -A` to add your changes (please don't add any changes to the `dist` directory). 13 | 9. Run `npm run commit` (**Do not** use `git commit`) - follow the prompts to create your git message 14 | 10. Push your changes with `git push` 15 | 11. Create the Pull Request 16 | 12. Get merged and celebrate 🎉 🎊! 17 | -------------------------------------------------------------------------------- /src/index.test.js: -------------------------------------------------------------------------------- 1 | import { 2 | expect 3 | } from 'chai'; 4 | import costelog from './index'; 5 | 6 | describe('costelog', function () { 7 | describe('all', function () { 8 | it('should be an array of strings', function () { 9 | expect(costelog.all()).to.satisfy(isArrayOfStrings); 10 | 11 | function isArrayOfStrings(array) { 12 | return array.every(function (item) { 13 | return typeof item === 'string'; 14 | }); 15 | } 16 | }); 17 | }); 18 | 19 | describe('random', function () { 20 | it('should return a random item from the costelog.all', function () { 21 | var randomItem = costelog.random(); 22 | expect(costelog.all()).to.include(randomItem); 23 | }); 24 | }); 25 | }); -------------------------------------------------------------------------------- /src/costelog.json: -------------------------------------------------------------------------------- 1 | [ 2 | "Que vaina e buena", 3 | "Ya te dije #NAME{cuadro}", 4 | "Va pa' esa #NAME{}", 5 | "#NAME{} Que vaina linda", 6 | "Nombe #NAME{}", 7 | "Liston de cativo", 8 | "Liston de madera", 9 | "Lloralo #NAME{papá}", 10 | "Ajá #NAME{compae}", 11 | "Eche #NAME{cuadro}", 12 | "Erda #NAME{}", 13 | "Echale guineo", 14 | "Puya el burro", 15 | "#NAME{Papi} qué?", 16 | "Todo bien #NAME{}", 17 | "Mira pa' ve", 18 | "Joda #NAME{cuadro}", 19 | "Mandas cascara #NAME{}", 20 | "Sigue creyendo que la marimonda es Mickey", 21 | "Sisa #NAME{cole}", 22 | "Tronco 'e hueso", 23 | "Qué na' #NAME{}", 24 | "Uy, #NAME{mani}", 25 | "¿Qué dijiste? ¿Coroné?", 26 | "Estás jodido #NAME{}", 27 | "Cogela suave", 28 | "Pago vale mia", 29 | "La que te cae #NAME{mi llave}" 30 | ] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # costelog 2 | 3 | [![travis build](https://img.shields.io/travis/gmoralesc/costelog.svg?style=flat-square)](https://travis-ci.org/gmoralesc/costelog) 4 | [![codecov coverage](https://img.shields.io/codecov/c/github/gmoralesc/costelog.svg?style=flat-square)](https://codecov.io/github/gmoralesc/costelog) 5 | [![version](https://img.shields.io/npm/v/costelog.svg?style=flat-square)](http://npm.im/costelog) 6 | [![downloads](https://img.shields.io/npm/dm/costelog.svg?style=flat-square)](http://npm-stat.com/charts.html?package=costelog&from=2015-08-01) 7 | [![MIT License](https://img.shields.io/npm/l/costelog.svg?style=flat-square)](http://opensource.org/licenses/MIT) 8 | [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)](https://github.com/semantic-release/semantic-release) 9 | 10 | Get random sentence from Costeño idioms for your log. 11 | 12 | ## Installation 13 | 14 | This package is distributed via npm: 15 | 16 | ``` 17 | npm install costelog 18 | ``` 19 | 20 | ## Usage 21 | 22 | ```javascript 23 | var costelog = require('costelog'); 24 | var randomSentence = costelog.random(); 25 | var randomSentence = costelog.random("Name"); 26 | ``` 27 | 28 | ## Author 29 | 30 | This library was developed by [Gustavo Morales](https://twitter.com/gmoralesc) -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "costelog", 3 | "description": "Get random sentence from Costeño idioms for your log", 4 | "version": "0.0.0-semantically-released", 5 | "main": "dist/index.js", 6 | "scripts": { 7 | "commit": "git-cz", 8 | "check-coverage": "nyc check-coverage --statements 100 --branches 100 --functions 100 --lines 100", 9 | "start": "npm run test", 10 | "test:watch": "npm t -- --watch", 11 | "test": "mocha src/*.test.js --compilers js:babel-register", 12 | "cover": "nyc npm t", 13 | "prebuild": "rimraf dist", 14 | "build": "babel --copy-files --out-dir dist --ignore *.test.js src", 15 | "semantic-release": "semantic-release pre && npm publish && semantic-release post" 16 | }, 17 | "repository": { 18 | "type": "git", 19 | "url": "https://github.com/gmoralesc/costelog.git" 20 | }, 21 | "keywords": [ 22 | "random", 23 | "log", 24 | "latinoamerica", 25 | "colombia", 26 | "caribe" 27 | ], 28 | "files": [ 29 | "dist", 30 | "README.md" 31 | ], 32 | "author": "Gustavo Morales (http://gmoralec.me/)", 33 | "license": "MIT", 34 | "bugs": { 35 | "url": "https://github.com/gmoralesc/costelog/issues" 36 | }, 37 | "homepage": "https://github.com/gmoralesc/costelog#readme", 38 | "dependencies": { 39 | "unique-random-array": "1.0.0" 40 | }, 41 | "devDependencies": { 42 | "babel-cli": "^6.10.1", 43 | "babel-loader": "^6.2.4", 44 | "babel-preset-es2015": "^6.9.0", 45 | "babel-preset-stage-2": "^6.11.0", 46 | "babel-register": "^6.9.0", 47 | "chai": "^3.5.0", 48 | "commitizen": "^3.0.7", 49 | "cz-conventional-changelog": "^1.1.6", 50 | "ghooks": "^1.3.2", 51 | "json-loader": "^0.5.4", 52 | "mocha": "^5.2.0", 53 | "nyc": "^13.3.0", 54 | "rimraf": "^2.5.3", 55 | "semantic-release": "^15.13.8", 56 | "webpack": "^2.2.1" 57 | }, 58 | "config": { 59 | "ghooks": { 60 | "pre-commit": "npm run cover && npm run check-coverage" 61 | }, 62 | "commitizen": { 63 | "path": "node_modules/cz-conventional-changelog" 64 | } 65 | }, 66 | "babel": { 67 | "presets": [ 68 | "es2015", 69 | "stage-2" 70 | ] 71 | } 72 | } 73 | --------------------------------------------------------------------------------