Skip to content

Commit

Permalink
Upgrade to ES Modules
Browse files Browse the repository at this point in the history
  • Loading branch information
niksy committed Jun 8, 2018
1 parent 3a39f10 commit 334c736
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions 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,
Expand All @@ -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);
};
}
10 changes: 5 additions & 5 deletions 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
};
4 changes: 2 additions & 2 deletions throttle.js
Expand Up @@ -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`
Expand Down Expand Up @@ -88,4 +88,4 @@ module.exports = function ( delay, noTrailing, callback, debounceMode ) {
// Return the wrapper function.
return wrapper;

};
}

0 comments on commit 334c736

Please sign in to comment.