Skip to content

Commit

Permalink
feat: using semistandard and fixed some typos (#617)
Browse files Browse the repository at this point in the history
  • Loading branch information
helio-frota authored Dec 9, 2021
1 parent 2084fcc commit 7506923
Show file tree
Hide file tree
Showing 6 changed files with 17,830 additions and 51 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "eslint:recommended",
"extends": "semistandard",
"ignorePatterns": ["config/**/*.js"],
"env": {
"es6": true,
Expand Down
13 changes: 7 additions & 6 deletions lib/circuit.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class CircuitBreaker extends EventEmitter {
return !!error[OUR_ERROR];
}

/**
/**
* Create a new Status object,
* helpful when you need to prime a breaker with stats
* @param {Object} options -
Expand All @@ -122,7 +122,7 @@ class CircuitBreaker extends EventEmitter {
* @param {Object} options.stats user supplied stats
* @returns {Status} a new {@link Status} object
*/
static newStatus(options) {
static newStatus (options) {
return new Status(options);
}

Expand All @@ -139,7 +139,8 @@ class CircuitBreaker extends EventEmitter {
this.options.rollingPercentilesEnabled =
options.rollingPercentilesEnabled !== false;
this.options.capacity = Number.isInteger(options.capacity)
? options.capacity : Number.MAX_SAFE_INTEGER;
? options.capacity
: Number.MAX_SAFE_INTEGER;
this.options.errorFilter = options.errorFilter || (_ => false);

this.semaphore = new Semaphore(this.options.capacity);
Expand All @@ -152,10 +153,11 @@ class CircuitBreaker extends EventEmitter {
}

this[VOLUME_THRESHOLD] = Number.isInteger(options.volumeThreshold)
? options.volumeThreshold : 0;
? options.volumeThreshold
: 0;
this[WARMING_UP] = options.allowWarmUp === true;

// The user can pass in a Status object to inialize the Status/stats
// The user can pass in a Status object to initialize the Status/stats
if (this.options.status) {
// Do a check that this is a Status Object,
if (this.options.status instanceof Status) {
Expand All @@ -181,7 +183,6 @@ class CircuitBreaker extends EventEmitter {
this[OPEN] = !this[CLOSED] && !this[HALF_OPEN];

this[SHUTDOWN] = options.state.shutdown || false;

} else {
this[PENDING_CLOSE] = false;
this[ENABLED] = options.enabled !== false;
Expand Down
4 changes: 2 additions & 2 deletions lib/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class Status extends EventEmitter {
this[PERCENTILES] = [0.0, 0.25, 0.5, 0.75, 0.9, 0.95, 0.99, 0.995, 1];

// Default this value to true
this.rollingPercentilesEnabled
= options.rollingPercentilesEnabled !== false;
this.rollingPercentilesEnabled =
options.rollingPercentilesEnabled !== false;

// prime the window with buckets
for (let i = 0; i < this[BUCKETS]; i++) this[WINDOW][i] = bucket();
Expand Down
Loading

0 comments on commit 7506923

Please sign in to comment.