From 334c73687a139cc7976a662acce121ade6430b8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Nikoli=C4=87?= Date: Fri, 8 Jun 2018 11:57:27 +0200 Subject: [PATCH] Upgrade to ES Modules --- debounce.js | 6 +++--- index.js | 10 +++++----- throttle.js | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/debounce.js b/debounce.js index a5f6062..31afa75 100644 --- a/debounce.js +++ b/debounce.js @@ -1,6 +1,6 @@ /* eslint-disable no-undefined */ -var throttle = require('./throttle'); +import throttle from './throttle'; /** * Debounce execution of a function. Debouncing, unlike throttling, @@ -16,6 +16,6 @@ var throttle = require('./throttle'); * * @return {Function} A new, debounced function. */ -module.exports = function ( delay, atBegin, callback ) { +export default function ( delay, atBegin, callback ) { return callback === undefined ? throttle(delay, atBegin, false) : throttle(delay, callback, atBegin !== false); -}; +} diff --git a/index.js b/index.js index 913be31..ce2cf73 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ -var throttle = require('./throttle'); -var debounce = require('./debounce'); +import throttle from './throttle'; +import debounce from './debounce'; -module.exports = { - throttle: throttle, - debounce: debounce +export { + throttle, + debounce }; diff --git a/throttle.js b/throttle.js index e0801da..028debc 100644 --- a/throttle.js +++ b/throttle.js @@ -16,7 +16,7 @@ * * @return {Function} A new, throttled, function. */ -module.exports = function ( delay, noTrailing, callback, debounceMode ) { +export default function ( delay, noTrailing, callback, debounceMode ) { // After wrapper has stopped being called, this timeout ensures that // `callback` is executed at the proper times in `throttle` and `end` @@ -88,4 +88,4 @@ module.exports = function ( delay, noTrailing, callback, debounceMode ) { // Return the wrapper function. return wrapper; -}; +}