[
  {
    "path": ".gitattributes",
    "content": "* text=auto\n*.js text eol=lf\n"
  },
  {
    "path": ".gitignore",
    "content": "node_modules\ncoverage\ndist\n.nyc_output\n"
  },
  {
    "path": ".nvmrc",
    "content": "6\n"
  },
  {
    "path": ".travis.yml",
    "content": "sudo: false\nlanguage: node_js\ncache:\n  directories:\n    - node_modules\nbranches:\n  only:\n    - master\nnotifications:\n  email: false\nbefore_script:\n  - npm prune\nscript:\n  - npm run cover\n  - npm run check-coverage\n  - npm run build\nafter_success:\n  - npm run report-coverage\n  - npm run semantic-release\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "# Contributing\n\nTo contribute to the project, please follow these steps:\n\n1. Get approval for the idea by filing an issue and talking with me about the changes.\n2. Fork the repo\n3. Make a branch for your change\n4. Run `npm install`\n5. Run `npm start`\n6. Make your changes\n7. Test your changes (we have a githook that disallows anything less than 100% code coverage)\n8. Run `git add -A` to add your changes (please don't add any changes to the `dist` directory).\n9. Run `npm run commit` (**Do not** use `git commit`) - follow the prompts to create your git message\n10. Push your changes with `git push`\n11. Create the Pull Request\n12. Get merged and celebrate 🎉 🎊!\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\nCopyright (c) 2016 Kent C. Dodds\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# starwars-names\n\n[![travis build](https://img.shields.io/travis/kentcdodds/starwars-names.svg?style=flat-square)](https://travis-ci.org/kentcdodds/starwars-names)\n[![codecov coverage](https://img.shields.io/codecov/c/github/kentcdodds/starwars-names.svg?style=flat-square)](https://codecov.io/github/kentcdodds/starwars-names)\n[![version](https://img.shields.io/npm/v/starwars-names.svg?style=flat-square)](http://npm.im/starwars-names)\n[![downloads](https://img.shields.io/npm/dm/starwars-names.svg?style=flat-square)](http://npm-stat.com/charts.html?package=starwars-names&from=2015-08-01)\n[![MIT License](https://img.shields.io/npm/l/starwars-names.svg?style=flat-square)](http://opensource.org/licenses/MIT)\n[![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)\n\nGet random names from Star Wars characters.\n\n<a href=\"https://app.codesponsor.io/link/PKGFLnhDiFvsUA5P4kAXfiPs/kentcdodds/starwars-names\" rel=\"nofollow\"><img src=\"https://app.codesponsor.io/embed/PKGFLnhDiFvsUA5P4kAXfiPs/kentcdodds/starwars-names.svg\" style=\"width: 888px; height: 68px;\" alt=\"Sponsor\" /></a>\n\n![starwars-names](other/starwars-names.gif)\n\n## Installation\n\nThis package is distributed via npm:\n\n```\nnpm install starwars-names\n```\n\n## Usage\n\n```javascript\nvar names = require('starwars-names');\nvar allNames = names.all;\nvar randomName = names.random();\nvar threeRandomNames = names.random(3);\n```\n\n## Other\n\nThis library was developed by [me](https://twitter.com/kentcdodds) as part of an\n[egghead.io](http://egghead.io/) series called \"How to Write a JavaScript Library.\"\n\nI'm now also using it to give [a workshop](http://kcd.im/fem-oss) for\n[Frontend Masters](https://frontendmasters.com).\n\n### Project Setup\n\nThis project assumes you have [NodeJS v6](http://nodejs.org/) or greater installed. You should\nalso have [npm v3](https://www.npmjs.com/) or greater installed as well (this comes packaged\nwith Node 6). You'll also need a recent version of [git](https://git-scm.com/) installed\nas well.\n\nYou may have come to this project from different varying sources. There are a\ndifferent series of branches for each workshop/course I've done. To get started with\nthe project, start with this:\n\n1. [Sign up](https://github.com/join) for a GitHub Account (if you don't already have one)\n2. [Fork](https://help.github.com/articles/fork-a-repo/) this repo\n3. [Clone](https://help.github.com/articles/cloning-a-repository/) your fork\n4. In the directory you cloned the repository, run `git fetch --all`\n\nIf you need help with these steps, you might check out\n[this free Egghead.io course](http://kcd.im/pull-request) which can help you get things going.\n\nFinally, based on which version of the project you're looking for (workshop, egghead, or\nFrontend Masters) you'll run one of the following commands in the cloned directory:\n\n- **Frontend Masters Workshop**: `npm run setup:fem`\n- **Egghead Course**: `npm run setup:egghead`\n\nIf you get any failures at this point something is wrong and needs to be fixed. Remember,\n[Google](https://google.com) and [StackOverflow](https://stackoverflow.com) are your friends.\n\nYou might find it helpful to see a list of the available branches. Run: `git branch` for that.\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"starwars-names\",\n  \"version\": \"0.0.0-semantically-released\",\n  \"description\": \"Get random Star Wars names\",\n  \"main\": \"dist/index.js\",\n  \"scripts\": {\n    \"commit\": \"git-cz\",\n    \"check-coverage\": \"nyc check-coverage --statements 100 --branches 100 --functions 100 --lines 100\",\n    \"report-coverage\": \"cat ./coverage/lcov.info | codecov\",\n    \"start\": \"npm run test\",\n    \"watch:test\": \"npm t -- --watch\",\n    \"test\": \"mocha src/index.test.js --compilers js:babel-register\",\n    \"cover\": \"nyc --reporter=lcov npm t\",\n    \"prebuild\": \"rimraf dist\",\n    \"build\": \"npm-run-all --parallel build:*\",\n    \"build:main\": \"babel --copy-files --out-dir dist --ignore *.test.js src\",\n    \"build:umd\": \"webpack --output-filename index.umd.js\",\n    \"build:umd.min\": \"webpack --output-filename index.umd.min.js -p\",\n    \"validate\": \"npm run cover && npm run check-coverage\",\n    \"setup\": \"npm install && npm run validate\",\n    \"setup:fem\": \"git checkout FEM/10.1-docs && npm install && npm run validate && rimraf .nyc_output coverage dist .git/hooks && git checkout FEM/00-scratch\",\n    \"setup:egghead\": \"npm run setup && rimraf dist coverage && git checkout lesson/02-setting-up-github\",\n    \"semantic-release\": \"semantic-release pre && npm publish && semantic-release post\"\n  },\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/kentcdodds/starwars-names.git\"\n  },\n  \"keywords\": [\n    \"random\",\n    \"star\",\n    \"wars\"\n  ],\n  \"files\": [\n    \"dist\",\n    \"README.md\"\n  ],\n  \"author\": \"Kent C. Dodds <kent@doddsfamily.us> (http://kentcdodds.com/)\",\n  \"license\": \"MIT\",\n  \"bugs\": {\n    \"url\": \"https://github.com/kentcdodds/starwars-names/issues\"\n  },\n  \"homepage\": \"https://github.com/kentcdodds/starwars-names#readme\",\n  \"dependencies\": {\n    \"unique-random-array\": \"1.0.0\"\n  },\n  \"devDependencies\": {\n    \"babel-cli\": \"6.11.4\",\n    \"babel-loader\": \"6.2.4\",\n    \"babel-preset-es2015\": \"6.13.2\",\n    \"babel-preset-stage-2\": \"6.13.0\",\n    \"babel-register\": \"6.11.6\",\n    \"chai\": \"3.5.0\",\n    \"codecov\": \"1.0.1\",\n    \"commitizen\": \"2.8.5\",\n    \"cz-conventional-changelog\": \"1.1.6\",\n    \"ghooks\": \"1.3.2\",\n    \"json-loader\": \"0.5.4\",\n    \"mocha\": \"3.0.1\",\n    \"npm-run-all\": \"2.3.0\",\n    \"nyc\": \"7.1.0\",\n    \"rimraf\": \"2.5.4\",\n    \"semantic-release\": \"^4.2.1\",\n    \"webpack\": \"1.13.1\"\n  },\n  \"engines\": {\n    \"node\": \"6.x\",\n    \"npm\": \"3.x\"\n  },\n  \"config\": {\n    \"ghooks\": {\n      \"pre-commit\": \"npm run validate\"\n    },\n    \"commitizen\": {\n      \"path\": \"node_modules/cz-conventional-changelog\"\n    }\n  },\n  \n  \"babel\": {\n    \"presets\": [\n      \"es2015\",\n      \"stage-2\"\n    ]\n  }\n}\n"
  },
  {
    "path": "src/index.js",
    "content": "import uniqueRandomArray from 'unique-random-array';\nimport starWarsNames from './starwars-names.json';\n\nconst getRandomItem = uniqueRandomArray(starWarsNames);\n\nmodule.exports = {\n  all: starWarsNames,\n  random: random\n};\n\nfunction random(number) {\n  if (number === undefined) {\n    return getRandomItem();\n  } else {\n    const randomItems = [];\n    for (let i = 0; i < number; i++) {\n      randomItems.push(getRandomItem());\n    }\n    return randomItems;\n  }\n}\n"
  },
  {
    "path": "src/index.test.js",
    "content": "import {expect} from 'chai';\nimport starWars from './index';\n\ndescribe('starwars-names', function() {\n  describe('all', function() {\n    it('should be an array of strings', function() {\n      expect(starWars.all).to.satisfy(isArrayOfStrings);\n\n      function isArrayOfStrings(array) {\n        return array.every(function(item) {\n          return typeof item === 'string';\n        });\n      }\n    });\n\n    it('should contain `Luke Skywalker`', function() {\n      expect(starWars.all).to.include('Luke Skywalker');\n    });\n  });\n\n  describe('random', function() {\n    it('should return a random item from the starWars.all', function() {\n      var randomItem = starWars.random();\n      expect(starWars.all).to.include(randomItem);\n    });\n\n    it('should return an array of random items if passed a number', function() {\n      var randomItems = starWars.random(3);\n      expect(randomItems).to.have.length(3);\n      randomItems.forEach(function(item) {\n        expect(starWars.all).to.include(item);\n      });\n    });\n  });\n});\n"
  },
  {
    "path": "src/starwars-names.json",
    "content": "[\n  \"4-LOM\",\n  \"Aayla Secura\",\n  \"Admiral Ackbar\",\n  \"Admiral Thrawn\",\n  \"Ahsoka Tano\",\n  \"Anakin Solo\",\n  \"Asajj Ventress\",\n  \"Aurra Sing\",\n  \"Senator Bail Organa\",\n  \"Barriss Offee\",\n  \"Bastila Shan\",\n  \"Ben Skywalker\",\n  \"Bib Fortuna\",\n  \"Biggs Darklighter\",\n  \"Boba Fett\",\n  \"Bossk\",\n  \"Brakiss\",\n  \"C-3PO\",\n  \"Cad Bane\",\n  \"Cade Skywalker\",\n  \"Callista Ming\",\n  \"Captain Rex\",\n  \"Carnor Jax\",\n  \"Chewbacca\",\n  \"Clone Commander Cody\",\n  \"Count Dooku\",\n  \"Darth Bane\",\n  \"Darth Krayt\",\n  \"Darth Maul\",\n  \"Darth Nihilus\",\n  \"Darth Vader\",\n  \"Dash Rendar\",\n  \"Dengar\",\n  \"Durge\",\n  \"Emperor Palpatine\",\n  \"Exar Kun\",\n  \"Galen Marek\",\n  \"General Crix Madine\",\n  \"General Dodonna\",\n  \"General Grievous\",\n  \"General Veers\",\n  \"Gilad Pellaeon\",\n  \"Grand Moff Tarkin\",\n  \"Greedo\",\n  \"Han Solo\",\n  \"IG 88\",\n  \"Jabba The Hutt\",\n  \"Jacen Solo\",\n  \"Jaina Solo\",\n  \"Jango Fett\",\n  \"Jarael\",\n  \"Jerec\",\n  \"Joruus C'Baoth\",\n  \"Ki-Adi-Mundi\",\n  \"Kir Kanos\",\n  \"Kit Fisto\",\n  \"Kyle Katarn\",\n  \"Kyp Durron\",\n  \"Lando Calrissian\",\n  \"Luke Skywalker\",\n  \"Luminara Unduli\",\n  \"Lumiya\",\n  \"Mace Windu\",\n  \"Mara Jade\",\n  \"Mission Vao\",\n  \"Natasi Daala\",\n  \"Nom Anor\",\n  \"Obi-Wan Kenobi\",\n  \"Padmé Amidala\",\n  \"Plo Koon\",\n  \"Pre Vizsla\",\n  \"Prince Xizor\",\n  \"Princess Leia\",\n  \"PROXY\",\n  \"Qui-Gon Jinn\",\n  \"Quinlan Vos\",\n  \"R2-D2\",\n  \"Rahm Kota\",\n  \"Revan\",\n  \"Satele Shan\",\n  \"Savage Opress\",\n  \"Sebulba\",\n  \"Shaak Ti\",\n  \"Shmi Skywalker\",\n  \"Talon Karrde\",\n  \"Ulic Qel-Droma\",\n  \"Visas Marr\",\n  \"Watto\",\n  \"Wedge Antilles\",\n  \"Yoda\",\n  \"Zam Wesell\",\n  \"Zayne Carrick\",\n  \"Zuckuss\"\n]\n"
  },
  {
    "path": "webpack.config.babel.js",
    "content": "import {join} from 'path'\n\nconst include = join(__dirname, 'src')\n\nexport default {\n  entry: './src/index',\n  output: {\n    path: join(__dirname, 'dist'),\n    libraryTarget: 'umd',\n    library: 'starWarsNames',\n  },\n  devtool: 'source-map',\n  module: {\n    loaders: [\n      {test: /\\.js$/, loader: 'babel', include},\n      {test: /\\.json$/, 'loader': 'json', include},\n    ]\n  }\n}\n"
  }
]