Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@autoguru/utilities

Package Overview
Dependencies
Maintainers
2
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@autoguru/utilities - npm Package Compare versions

Comparing version 1.0.64 to 1.0.65

dist/events/bindEvent.d.ts

1

dist/events/index.d.ts
export { wrapEvent } from './wrapEvent';
export { bindEvent } from './bindEvent';

2

dist/events/wrapEvent.d.ts
declare type Handler<EventType> = (event: EventType) => void;
export declare const wrapEvent: <E extends Partial<Event>>(callback: Handler<E>, handler?: Handler<E>) => (event: E) => void;
export declare const wrapEvent: <E extends Partial<Event>>(handler: Handler<E>, consumerHandler?: Handler<E>) => (event: E) => void;
export {};
export { default as warning } from 'tiny-warning';
import invariant from 'tiny-invariant';
export { default as invariant } from 'tiny-invariant';

@@ -6,11 +7,18 @@

const wrapEvent = (callback, handler) => (event) => {
if (handler) {
handler(event);
const wrapEvent = (handler, consumerHandler) => (event) => {
invariant(typeof handler === 'function', 'You must supply a handler method.');
handler(event);
if (!event.defaultPrevented && typeof consumerHandler !== 'undefined') {
invariant(typeof consumerHandler === 'function', 'You supplied a consumer handler that was supposed to be a function.');
return consumerHandler(event);
}
if (!event.defaultPrevented) {
return callback(event);
}
};
export { clamp, wrapEvent };
const bindEvent = (node, event, callback) => {
node.addEventListener(event, callback);
return () => {
node.removeEventListener(event, callback);
};
};
export { bindEvent, clamp, wrapEvent };

@@ -8,18 +8,26 @@ 'use strict';

var tinyWarning = _interopDefault(require('tiny-warning'));
var tinyInvariant = _interopDefault(require('tiny-invariant'));
var invariant = _interopDefault(require('tiny-invariant'));
const clamp = (value, min, max) => Math.min(max, Math.max(value, min));
const wrapEvent = (callback, handler) => (event) => {
if (handler) {
handler(event);
const wrapEvent = (handler, consumerHandler) => (event) => {
invariant(typeof handler === 'function', 'You must supply a handler method.');
handler(event);
if (!event.defaultPrevented && typeof consumerHandler !== 'undefined') {
invariant(typeof consumerHandler === 'function', 'You supplied a consumer handler that was supposed to be a function.');
return consumerHandler(event);
}
if (!event.defaultPrevented) {
return callback(event);
}
};
const bindEvent = (node, event, callback) => {
node.addEventListener(event, callback);
return () => {
node.removeEventListener(event, callback);
};
};
exports.warning = tinyWarning;
exports.invariant = tinyInvariant;
exports.invariant = invariant;
exports.bindEvent = bindEvent;
exports.clamp = clamp;
exports.wrapEvent = wrapEvent;
{
"name": "@autoguru/utilities",
"version": "1.0.64",
"version": "1.0.65",
"description": "A collection of smallish things that help AutoGuru write code.",

@@ -24,8 +24,8 @@ "homepage": "https://github.com/autoguru-au/octane/tree/master/packages/utilities#readme",

"devDependencies": {
"@autoguru/eslint-plugin": "^1.0.62",
"@autoguru/eslint-plugin": "^1.0.65",
"@autoguru/jest-preset": "^1.0.64",
"@autoguru/tsconfig": "^1.0.63",
"rollup": "^1.19.4",
"rollup-plugin-typescript2": "^0.22.1",
"typescript": "~3.5.3"
"rollup": "^1.20.3",
"rollup-plugin-typescript2": "^0.24.0",
"typescript": "~3.6.2"
},

@@ -35,3 +35,3 @@ "publishConfig": {

},
"gitHead": "74ab60bd3318a8b81d9e69805cf2959afd4c17fa"
"gitHead": "76af5f4b3377f49e2d011ad597c4420344121b3d"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc