flint-tools
Advanced tools
Comparing version 1.3.136 to 1.3.137
@@ -1,3 +0,4 @@ | ||
Object.defineProperty(exports, "__esModule", { value: true });exports.onKey = onKey;var keys = {};exports.keys = keys; | ||
Object.defineProperty(exports, "__esModule", { value: true });exports.onKey = onKey;exports.onKeyPress = onKeyPress;exports.onKeyDown = onKeyDown;var keys = {};exports.keys = keys; | ||
var listeners = {}; | ||
var pressListeners = {}; | ||
@@ -16,2 +17,8 @@ on.keydown(window, function (e) { | ||
on.keypress(window, function (e) { | ||
var code = ___keycode(e.keyCode); | ||
var queue = pressListeners[code]; | ||
queue && queue.forEach(function (listener) {return listener();});}); | ||
function keyDown(code) { | ||
@@ -29,2 +36,11 @@ if (!listeners[code]) return; | ||
listeners[code] = listeners[code] || []; | ||
listeners[code].push(fn);} | ||
listeners[code].push(fn);} | ||
function onKeyPress(code, fn) { | ||
pressListeners[code] = pressListeners[code] || []; | ||
pressListeners[code].push(fn);} | ||
function onKeyDown(code, fn) { | ||
onKey(code, function (val) {return val && fn();});} |
/******/ (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) | ||
@@ -18,23 +18,23 @@ /******/ var module = installedModules[moduleId] = { | ||
/******/ }; | ||
/******/ | ||
/******/ // 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 | ||
@@ -99,5 +99,6 @@ /******/ return __webpack_require__(0); | ||
Object.defineProperty(exports, "__esModule", { value: true });exports.onKey = onKey;var keys = {};exports.keys = keys; | ||
Object.defineProperty(exports, "__esModule", { value: true });exports.onKey = onKey;exports.onKeyPress = onKeyPress;exports.onKeyDown = onKeyDown;var keys = {};exports.keys = keys; | ||
var listeners = {}; | ||
var pressListeners = {}; | ||
on.keydown(window, function (e) { | ||
@@ -107,4 +108,4 @@ var code = ___keycode(e.keyCode); | ||
keyDown(code);}); | ||
on.keyup(window, function (e) { | ||
@@ -114,17 +115,32 @@ var code = ___keycode(e.keyCode); | ||
keyUp(code);}); | ||
on.keypress(window, function (e) { | ||
var code = ___keycode(e.keyCode); | ||
var queue = pressListeners[code]; | ||
queue && queue.forEach(function (listener) {return listener();});}); | ||
function keyDown(code) { | ||
if (!listeners[code]) return; | ||
listeners[code].forEach(function (listener) {return listener(true);});} | ||
function keyUp(code) { | ||
if (!listeners[code]) return; | ||
listeners[code].forEach(function (listener) {return listener(false);});} | ||
function onKey(code, fn) { | ||
listeners[code] = listeners[code] || []; | ||
listeners[code].push(fn);} | ||
function onKeyPress(code, fn) { | ||
pressListeners[code] = pressListeners[code] || []; | ||
pressListeners[code].push(fn);} | ||
function onKeyDown(code, fn) { | ||
onKey(code, function (val) {return val && fn();});} | ||
@@ -136,30 +152,30 @@ /***/ }, | ||
Object.defineProperty(exports, '__esModule', { value: true });exports['default'] = | ||
createFilterer;var assign = Object.assign;var keys = Object.keys;function createFilterer(data, options) { | ||
options || (options = {}); | ||
var cache = {}; | ||
return function (query) { | ||
var subquery; | ||
if (!cache[query]) { | ||
for (var i = query.length - 1; i > 0; i -= 1) { | ||
subquery = query.substr(0, i); | ||
if (cache[subquery]) { | ||
cache[query] = find(cache[subquery], query, options); | ||
break;}}} | ||
if (!cache[query]) { | ||
cache[query] = find(data, query, options);} | ||
return cache[query];};} | ||
; | ||
function find(data, query, options) { | ||
@@ -169,7 +185,7 @@ return keys(data).reduce(function (acc, key) { | ||
var matches; | ||
if (isPrimitive(value)) { | ||
if (contains(query, key, options) || contains(query, value, options)) { | ||
acc[key] = value;}} else | ||
{ | ||
@@ -180,13 +196,13 @@ if (contains(query, key, options)) { | ||
matches = find(value, query, options); | ||
if (!isEmpty(matches)) { | ||
assign(acc, pair(key, matches));}}} | ||
return acc;}, | ||
{});} | ||
function contains(query, string, options) { | ||
@@ -198,10 +214,10 @@ if (options.ignoreCase) { | ||
return string && String(string).indexOf(query) !== -1;}} | ||
function isPrimitive(value) { | ||
var t = getType(value); | ||
return t !== 'Object' && t !== 'Array';} | ||
function pair(key, value) { | ||
@@ -224,13 +240,13 @@ var p = {}; | ||
Object.defineProperty(exports, '__esModule', { value: true });exports['default'] = | ||
lens;var PATH_DELIMITER = '.';function lens(data, path) { | ||
var p = path.split(PATH_DELIMITER); | ||
var segment = p.shift(); | ||
if (!segment) { | ||
return data;} | ||
var t = getType(data); | ||
if (t === 'Array' && data[integer(segment)]) { | ||
@@ -240,5 +256,5 @@ return lens(data[integer(segment)], p.join(PATH_DELIMITER));} else | ||
return lens(data[segment], p.join(PATH_DELIMITER));}} | ||
function integer(string) { | ||
@@ -252,3 +268,3 @@ return parseInt(string, 10);}module.exports = exports['default']; | ||
Object.defineProperty(exports, "__esModule", { value: true });exports["default"] = | ||
uid;var id = Math.ceil(Math.random() * 10);function uid() { | ||
@@ -258,2 +274,3 @@ return id++;}module.exports = exports["default"]; | ||
/***/ } | ||
/******/ ]); | ||
/******/ ]); | ||
//# sourceMappingURL=internals.js.map |
{ | ||
"port": 4000, | ||
"wport": 6283, | ||
"installed": [ | ||
@@ -5,0 +3,0 @@ "keycode", |
@@ -6,3 +6,3 @@ { | ||
"description": "tools", | ||
"version": "1.3.136", | ||
"version": "1.3.137", | ||
"main": "index.js", | ||
@@ -9,0 +9,0 @@ "scripts": {}, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3597850
46
8782