Skip to content

Commit

Permalink
added the library to npm
Browse files Browse the repository at this point in the history
  • Loading branch information
jensrott committed Oct 17, 2019
1 parent e5e9cf9 commit 100cdd0
Show file tree
Hide file tree
Showing 15 changed files with 9,070 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"
]
}
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Only uses this .editorconfig file
root = true

# General settings for whole project
[*]
indent_style = space
end_of_line = lf
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true

# Format specific overrides (markdown)
[*.md]
max_line_length = 0
trim_trailing_whitespace = false
9 changes: 9 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"parser": "babel-eslint",
"extends": "airbnb-base",
"env": {
"browser": true,
"node": true,
"jest": true
}
}
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
language: node_js
node_js:
- node

script:
- npm run coverage -- --coverageReporters=text-lcov | coveralls
169 changes: 169 additions & 0 deletions dist/bike-names.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else {
var a = factory();
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
}
})(window, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ({

/***/ "./node_modules/unique-random-array/index.js":
/*!***************************************************!*\
!*** ./node_modules/unique-random-array/index.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
eval("\nconst uniqueRandom = __webpack_require__(/*! unique-random */ \"./node_modules/unique-random/index.js\");\n\nmodule.exports = array => {\n\tconst random = uniqueRandom(0, array.length - 1);\n\treturn () => array[random()];\n};\n\n\n//# sourceURL=webpack:///./node_modules/unique-random-array/index.js?");

/***/ }),

/***/ "./node_modules/unique-random/index.js":
/*!*********************************************!*\
!*** ./node_modules/unique-random/index.js ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

"use strict";
eval("\n\nmodule.exports = (minimum, maximum) => {\n\tlet previousValue;\n\treturn function random() {\n\t\tconst number = Math.floor(\n\t\t\t(Math.random() * (maximum - minimum + 1)) + minimum\n\t\t);\n\t\tpreviousValue = number === previousValue && minimum !== maximum ? random() : number;\n\t\treturn previousValue;\n\t};\n};\n\n\n//# sourceURL=webpack:///./node_modules/unique-random/index.js?");

/***/ }),

/***/ "./node_modules/webpack/buildin/harmony-module.js":
/*!*******************************************!*\
!*** (webpack)/buildin/harmony-module.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports) {

eval("module.exports = function(originalModule) {\n\tif (!originalModule.webpackPolyfill) {\n\t\tvar module = Object.create(originalModule);\n\t\t// module.parent = undefined by default\n\t\tif (!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"exports\", {\n\t\t\tenumerable: true\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n\n\n//# sourceURL=webpack:///(webpack)/buildin/harmony-module.js?");

/***/ }),

/***/ "./src/bike-names.json":
/*!*****************************!*\
!*** ./src/bike-names.json ***!
\*****************************/
/*! exports provided: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, default */
/***/ (function(module) {

eval("module.exports = JSON.parse(\"[\\\"Pinarello\\\",\\\"Eddy Merckx\\\",\\\"BMC\\\",\\\"Trek\\\",\\\"Specialized\\\",\\\"Giant\\\",\\\"Ridley\\\",\\\"Raleigh\\\",\\\"GT\\\",\\\"Focus\\\",\\\"Salsa\\\",\\\"Cannondale\\\",\\\"Felt\\\",\\\"Cervelo\\\",\\\"Bianchi\\\",\\\"Jamis\\\",\\\"Surly\\\",\\\"Soma\\\",\\\"Diamondback\\\",\\\"Merida\\\",\\\"Kona\\\",\\\"Fuji\\\",\\\"Dahon\\\",\\\"Scott\\\",\\\"Santa Cruz\\\",\\\"Marin\\\"]\");\n\n//# sourceURL=webpack:///./src/bike-names.json?");

/***/ }),

/***/ "./src/index.js":
/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
/*! no exports provided */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(function(module) {/* harmony import */ var unique_random_array__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! unique-random-array */ \"./node_modules/unique-random-array/index.js\");\n/* harmony import */ var unique_random_array__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(unique_random_array__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _bike_names_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./bike-names.json */ \"./src/bike-names.json\");\nvar _bike_names_json__WEBPACK_IMPORTED_MODULE_1___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./bike-names.json */ \"./src/bike-names.json\", 1);\n\n\n\n\nmodule.exports = {\n all: _bike_names_json__WEBPACK_IMPORTED_MODULE_1__,\n random: unique_random_array__WEBPACK_IMPORTED_MODULE_0___default()(_bike_names_json__WEBPACK_IMPORTED_MODULE_1__),\n};\n\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../node_modules/webpack/buildin/harmony-module.js */ \"./node_modules/webpack/buildin/harmony-module.js\")(module)))\n\n//# sourceURL=webpack:///./src/index.js?");

/***/ }),

/***/ 0:
/*!****************************!*\
!*** multi ./src/index.js ***!
\****************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("module.exports = __webpack_require__(/*! ./src/index.js */\"./src/index.js\");\n\n\n//# sourceURL=webpack:///multi_./src/index.js?");

/***/ })

/******/ });
});
1 change: 1 addition & 0 deletions dist/bike-names.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 29 additions & 0 deletions lib/bike-names.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[
"Pinarello",
"Eddy Merckx",
"BMC",
"Trek",
"Specialized",
"Giant",
"Ridley",
"Raleigh",
"GT",
"Focus",
"Salsa",
"Cannondale",
"Felt",
"Cervelo",
"Bianchi",
"Jamis",
"Surly",
"Soma",
"Diamondback",
"Merida",
"Kona",
"Fuji",
"Dahon",
"Scott",
"Santa Cruz",
"Marin"

]
12 changes: 12 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
"use strict";

var _uniqueRandomArray = _interopRequireDefault(require("unique-random-array"));

var _bikeNames = _interopRequireDefault(require("./bike-names.json"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

module.exports = {
all: _bikeNames["default"],
random: (0, _uniqueRandomArray["default"])(_bikeNames["default"])
};
21 changes: 21 additions & 0 deletions lib/index.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"use strict";

var _index = _interopRequireDefault(require("./index"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

describe('bike-names', function () {
test('It exists', function () {
expect(_index["default"].all).toBeDefined();
});
});
describe('random', function () {
test('It exists', function () {
expect(_index["default"].random()).toBeDefined();
});
test('Should return a random item from the bikeNames.all', function () {
var randomItem = _index["default"].random();

expect(_index["default"].all).toContain(randomItem);
});
});
Loading

0 comments on commit 100cdd0

Please sign in to comment.