Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

commonjs -> ecmascript modules #87

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion index.js

This file was deleted.

2 changes: 2 additions & 0 deletions index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import retry from './lib/retry.mjs'
export default retry
6 changes: 5 additions & 1 deletion lib/retry.js → lib/retry.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
var RetryOperation = require('./retry_operation');
import RetryOperation from './retry_operation.mjs'

var exports = {}

exports.operation = function(options) {
var timeouts = exports.timeouts(options);
Expand Down Expand Up @@ -98,3 +100,5 @@ exports.wrap = function(obj, options, methods) {
obj[method].options = options;
}
};

export default exports
3 changes: 2 additions & 1 deletion lib/retry_operation.js → lib/retry_operation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ function RetryOperation(timeouts, options) {
this._cachedTimeouts = this._timeouts.slice(0);
}
}
module.exports = RetryOperation;

RetryOperation.prototype.reset = function() {
this._attempts = 1;
Expand Down Expand Up @@ -160,3 +159,5 @@ RetryOperation.prototype.mainError = function() {

return mainError;
};

export default RetryOperation
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"directories": {
"lib": "./lib"
},
"main": "index.js",
"main": "index.mjs",
"engines": {
"node": ">= 4"
},
Expand Down