UNPKG

charades-keywords

Version:
331 lines (310 loc) 8.55 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["charadesKeywords"] = factory(); else root["charadesKeywords"] = factory(); })(this, 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] = { /******/ exports: {}, /******/ id: moduleId, /******/ loaded: false /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.loaded = 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; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _charadesKeywords = __webpack_require__(1); var _utils = __webpack_require__(2); var mainExport = { all: _charadesKeywords.keywords, random: function random(qty, config) { if (config && config.complexity && config.category === undefined) { var filteredByComplexity = _charadesKeywords.keywords.filter(function (keyword) { return keyword.complexity === config.complexity; }); return (0, _utils.getRandomItems)(qty, filteredByComplexity); } if (config && config.category && config.complexity === undefined) { var filteredByCategory = _charadesKeywords.keywords.filter(function (keyword) { return keyword.category === config.category; }); return (0, _utils.getRandomItems)(qty, filteredByCategory); } if (config && config.category && config.complexity) { var filteredByComplexityAndCategory = _charadesKeywords.keywords.filter(function (keyword) { return keyword.category === config.category && keyword.complexity === config.complexity; }); return (0, _utils.getRandomItems)(qty, filteredByComplexityAndCategory); } return (0, _utils.getRandomItems)(qty, _charadesKeywords.keywords); } }; exports.default = mainExport; /***/ }, /* 1 */ /***/ function(module, exports) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var CATEGORIES = exports.CATEGORIES = { PERSON: 'person', ANIMAL: 'animal', ITEM: 'item', PROVERB: 'proverb', ACTIVITY: 'activity', TITLE: 'title', OTHER: 'other' }; var COMPLEXITY = exports.COMPLEXITY = { EASY: 'easy', MEDIUM: 'medium', HARD: 'hard' }; var keywords = exports.keywords = [{ category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.EASY, word: 'Pływanie' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.EASY, word: 'Bieganie' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.EASY, word: 'Jedzenie' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.EASY, word: 'Spanie' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.EASY, word: 'Pisanie' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.MEDIUM, word: 'Strzelać z łuku' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.MEDIUM, word: 'Pisać na klawiaturze' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.MEDIUM, word: 'Piłka nożna' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.MEDIUM, word: 'Rzut oszczepem' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.MEDIUM, word: 'Czytać książkę' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.HARD, word: 'Martwy ciąg' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.HARD, word: 'Kontemplować' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.HARD, word: 'Morsować' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.HARD, word: 'Kontemplować' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.HARD, word: 'Krzyczeć wniebogłosy' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.HARD, word: 'Emancypacja kobiet' }, { category: CATEGORIES.OTHER, complexity: COMPLEXITY.MEDIUM, word: 'Prohibicja' }, { category: CATEGORIES.TITLE, complexity: COMPLEXITY.HARD, word: 'Ostry cień mgły' }, { category: CATEGORIES.OTHER, complexity: COMPLEXITY.MEDIUM, word: 'Rozrywka' }, { category: CATEGORIES.OTHER, complexity: COMPLEXITY.HARD, word: 'Sieć 5G' }, { category: CATEGORIES.OTHER, complexity: COMPLEXITY.HARD, word: 'Stulejka' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.EASY, word: 'Bieganie' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.EASY, word: 'Spanie' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.EASY, word: 'Leżenie' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.EASY, word: 'Chodzenie' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.EASY, word: 'Rzucanie' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.MEDIUM, word: 'Trekking' }, { category: CATEGORIES.ANIMAL, complexity: COMPLEXITY.HARD, word: 'Czerwona panda' }, { category: CATEGORIES.ANIMAL, complexity: COMPLEXITY.MEDIUM, word: 'Delfin' }, { category: CATEGORIES.ANIMAL, complexity: COMPLEXITY.EASY, word: 'Krowa' }, { category: CATEGORIES.ANIMAL, complexity: COMPLEXITY.EASY, word: 'Pies' }, { category: CATEGORIES.ANIMAL, complexity: COMPLEXITY.EASY, word: 'Kot' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.HARD, word: 'Kłusowanie' }, { category: CATEGORIES.PERSON, complexity: COMPLEXITY.EASY, word: 'Mariusz Pudzianowski' }, { category: CATEGORIES.PERSON, complexity: COMPLEXITY.EASY, word: 'Kamil Stoch' }, { category: CATEGORIES.TITLE, complexity: COMPLEXITY.EASY, word: 'Harry Potter' }, { category: CATEGORIES.TITLE, complexity: COMPLEXITY.EASY, word: 'Król lew' }, { category: CATEGORIES.ITEM, complexity: COMPLEXITY.MEDIUM, word: 'Świeczka zapachowa' }, { category: CATEGORIES.PROVERB, complexity: COMPLEXITY.MEDIUM, word: 'Baba z wozu koniom lżej' }, { category: CATEGORIES.PROVERB, complexity: COMPLEXITY.HARD, word: 'Niósl wilk razy kilka, ponieśli i wilka' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.EASY, word: 'Oglądanie telewizji' }, { category: CATEGORIES.ITEM, complexity: COMPLEXITY.EASY, word: 'Kierownica' }, { category: CATEGORIES.ACTIVITY, complexity: COMPLEXITY.HARD, word: 'Kwestionowanie' }]; /***/ }, /* 2 */ /***/ function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var getRandomItems = exports.getRandomItems = function getRandomItems(qty, array) { if (qty) { var randomItems = []; if (qty > array.length) { return array; } while (randomItems.length < qty) { var randomItem = array[Math.floor(Math.random() * array.length)]; // istanbul ignore next if (!randomItems.includes(randomItem)) { randomItems.push(randomItem); } } return randomItems; } else { return [array[Math.floor(Math.random() * array.length)]]; } }; /***/ } /******/ ]) }); ; //# sourceMappingURL=index.umd.js.map