Skip to content

Commit 173a102

Browse files
irace-striperattrayalex-stripe
authored andcommitted
ES5 commas as per rattrayalex
1 parent f40cc7e commit 173a102

35 files changed

+241
-241
lines changed

.prettierrc

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"arrowParens": "always",
3-
"trailingComma": "all",
3+
"trailingComma": "es5",
44
"bracketSpacing": false,
55
"singleQuote": true
6-
}
6+
}

examples/webhook-signing/express.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ app.post(
3434

3535
// Return a response to acknowledge receipt of the event
3636
res.json({received: true});
37-
},
37+
}
3838
);
3939

4040
app.listen(3000, function() {

lib/MultipartDataGenerator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function multipartDataGenerator(method, data, headers) {
3434
'Content-Disposition: form-data; name=' +
3535
q(k) +
3636
'; filename=' +
37-
q(v.name || 'blob'),
37+
q(v.name || 'blob')
3838
);
3939
push('Content-Type: ' + (v.type || 'application/octet-stream'));
4040
push('');

lib/StripeMethod.basic.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ module.exports = {
8080
return reject(err);
8181
}
8282
sendMetadata(data, auth);
83-
},
83+
}
8484
);
8585
}
8686

@@ -100,12 +100,12 @@ module.exports = {
100100
} else {
101101
resolve(response.metadata);
102102
}
103-
},
103+
}
104104
);
105105
}
106-
}.bind(this),
106+
}.bind(this)
107107
),
108-
cb,
108+
cb
109109
);
110110
},
111111

@@ -123,17 +123,17 @@ module.exports = {
123123
function(resolve, reject) {
124124
this._request('GET', null, path, {}, auth, {}, function(
125125
err,
126-
response,
126+
response
127127
) {
128128
if (err) {
129129
reject(err);
130130
} else {
131131
resolve(response.metadata);
132132
}
133133
});
134-
}.bind(this),
134+
}.bind(this)
135135
),
136-
cb,
136+
cb
137137
);
138138
},
139139
};

lib/StripeMethod.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ function stripeMethod(spec) {
2828

2929
var requestPromise = utils.callbackifyPromiseWithTimeout(
3030
makeRequest(self, args, spec, {}),
31-
callback,
31+
callback
3232
);
3333

3434
if (spec.methodType === 'list') {
3535
var autoPaginationMethods = makeAutoPaginationMethods(
3636
self,
3737
args,
3838
spec,
39-
requestPromise,
39+
requestPromise
4040
);
4141
Object.assign(requestPromise, autoPaginationMethods);
4242
}

lib/StripeResource.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function StripeResource(stripe, urlData) {
3030
this._urlData = urlData || {};
3131

3232
this.basePath = utils.makeURLInterpolator(
33-
this.basePath || stripe.getApiField('basePath'),
33+
this.basePath || stripe.getApiField('basePath')
3434
);
3535
this.resourcePath = this.path;
3636
this.path = utils.makeURLInterpolator(this.path);
@@ -67,7 +67,7 @@ StripeResource.prototype = {
6767
.join(
6868
this.basePath(urlData),
6969
this.path(urlData),
70-
typeof commandPath == 'function' ? commandPath(urlData) : commandPath,
70+
typeof commandPath == 'function' ? commandPath(urlData) : commandPath
7171
)
7272
.replace(/\\/g, '/'); // ugly workaround for Windows
7373
},
@@ -112,7 +112,7 @@ StripeResource.prototype = {
112112
'Request aborted due to timeout being reached (' + timeout + 'ms)',
113113
detail: timeoutErr,
114114
}),
115-
null,
115+
null
116116
);
117117
};
118118
},
@@ -188,7 +188,7 @@ StripeResource.prototype = {
188188
exception: e,
189189
requestId: headers['request-id'],
190190
}),
191-
null,
191+
null
192192
);
193193
}
194194

@@ -227,7 +227,7 @@ StripeResource.prototype = {
227227
message: self._generateConnectionErrorMessage(requestRetries),
228228
detail: error,
229229
}),
230-
null,
230+
null
231231
);
232232
};
233233
},
@@ -266,7 +266,7 @@ StripeResource.prototype = {
266266
// maxNetworkRetryDelay.
267267
var sleepSeconds = Math.min(
268268
initialNetworkRetryDelay * Math.pow(numRetries - 1, 2),
269-
maxNetworkRetryDelay,
269+
maxNetworkRetryDelay
270270
);
271271

272272
// Apply some jitter by randomizing the value in the range of
@@ -322,7 +322,7 @@ StripeResource.prototype = {
322322
StripeResource.MAX_BUFFERED_REQUEST_METRICS
323323
) {
324324
utils.emitWarning(
325-
'Request metrics buffer is full, dropping telemetry message.',
325+
'Request metrics buffer is full, dropping telemetry message.'
326326
);
327327
} else {
328328
this._stripe._prevRequestMetrics.push({
@@ -367,7 +367,7 @@ StripeResource.prototype = {
367367
method,
368368
data,
369369
options.headers,
370-
makeRequestWithData,
370+
makeRequestWithData
371371
);
372372
} else {
373373
makeRequestWithData(null, utils.stringifyRequestData(data || {}));
@@ -381,7 +381,7 @@ StripeResource.prototype = {
381381
self._getSleepTimeInMS(requestRetries),
382382
apiVersion,
383383
headers,
384-
requestRetries,
384+
requestRetries
385385
);
386386
}
387387

@@ -453,7 +453,7 @@ StripeResource.prototype = {
453453
// Send payload; we're safe:
454454
req.write(requestData);
455455
req.end();
456-
},
456+
}
457457
);
458458
} else {
459459
// we're already connected

lib/Webhooks.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var Webhook = {
1414
payload,
1515
header,
1616
secret,
17-
tolerance || Webhook.DEFAULT_TOLERANCE,
17+
tolerance || Webhook.DEFAULT_TOLERANCE
1818
);
1919

2020
var jsonPayload = JSON.parse(payload);
@@ -60,11 +60,11 @@ var signature = {
6060

6161
var expectedSignature = this._computeSignature(
6262
details.timestamp + '.' + payload,
63-
secret,
63+
secret
6464
);
6565

6666
var signatureFound = !!details.signatures.filter(
67-
utils.secureCompare.bind(utils, expectedSignature),
67+
utils.secureCompare.bind(utils, expectedSignature)
6868
).length;
6969

7070
if (!signatureFound) {
@@ -118,7 +118,7 @@ function parseHeader(header, scheme) {
118118
{
119119
timestamp: -1,
120120
signatures: [],
121-
},
121+
}
122122
);
123123
}
124124

lib/autoPagination.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function makeAutoPaginationMethods(self, requestArgs, spec, firstPagePromise) {
1717
)
1818
) {
1919
throw Error(
20-
'Unexpected: Stripe API response does not have a well-formed `data` array.',
20+
'Unexpected: Stripe API response does not have a well-formed `data` array.'
2121
);
2222
}
2323

@@ -90,7 +90,7 @@ function getDoneCallback(args) {
9090
if (typeof onDone !== 'function') {
9191
throw Error(
9292
'The second argument to autoPagingEach, if present, must be a callback function; receieved ' +
93-
typeof onDone,
93+
typeof onDone
9494
);
9595
}
9696
return onDone;
@@ -115,7 +115,7 @@ function getItemCallback(args) {
115115
if (typeof onItem !== 'function') {
116116
throw Error(
117117
'The first argument to autoPagingEach, if present, must be a callback function; receieved ' +
118-
typeof onItem,
118+
typeof onItem
119119
);
120120
}
121121

@@ -127,7 +127,7 @@ function getItemCallback(args) {
127127
if (onItem.length > 2) {
128128
throw Error(
129129
'The `onItem` callback function passed to autoPagingEach must accept at most two arguments; got ' +
130-
onItem,
130+
onItem
131131
);
132132
}
133133

@@ -147,7 +147,7 @@ function getLastId(listResult) {
147147
var lastId = lastItem && lastItem.id;
148148
if (!lastId) {
149149
throw Error(
150-
'Unexpected: No `id` found on the last item while auto-paging a list.',
150+
'Unexpected: No `id` found on the last item while auto-paging a list.'
151151
);
152152
}
153153
return lastId;
@@ -180,7 +180,7 @@ function makeAutoPagingEach(asyncIteratorNext) {
180180

181181
var autoPagePromise = wrapAsyncIteratorWithCallback(
182182
asyncIteratorNext,
183-
onItem,
183+
onItem
184184
);
185185
return utils.callbackifyPromiseWithTimeout(autoPagePromise, onDone);
186186
};
@@ -191,12 +191,12 @@ function makeAutoPagingToArray(autoPagingEach) {
191191
var limit = opts && opts.limit;
192192
if (!limit) {
193193
throw Error(
194-
'You must pass a `limit` option to autoPagingToArray, eg; `autoPagingToArray({limit: 1000});`.',
194+
'You must pass a `limit` option to autoPagingToArray, eg; `autoPagingToArray({limit: 1000});`.'
195195
);
196196
}
197197
if (limit > 10000) {
198198
throw Error(
199-
'You cannot specify a limit of more than 10,000 items to fetch in `autoPagingToArray`; use `autoPagingEach` to iterate through longer lists.',
199+
'You cannot specify a limit of more than 10,000 items to fetch in `autoPagingToArray`; use `autoPagingEach` to iterate through longer lists.'
200200
);
201201
}
202202
var promise = new Promise(function(resolve, reject) {

lib/makeRequest.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function getRequestOpts(self, requestArgs, spec, overrideData) {
4444
requestMethod +
4545
' ' +
4646
path +
47-
'`)',
47+
'`)'
4848
);
4949
}
5050

@@ -64,7 +64,7 @@ function getRequestOpts(self, requestArgs, spec, overrideData) {
6464
requestMethod +
6565
' ' +
6666
path +
67-
'`)',
67+
'`)'
6868
);
6969
}
7070

@@ -88,7 +88,7 @@ function getRequestOpts(self, requestArgs, spec, overrideData) {
8888
requestMethod +
8989
' `' +
9090
path +
91-
'`)',
91+
'`)'
9292
);
9393
}
9494

@@ -125,7 +125,7 @@ function makeRequest(self, requestArgs, spec, overrideData) {
125125
resolve(
126126
spec.transformResponseData
127127
? spec.transformResponseData(response)
128-
: response,
128+
: response
129129
);
130130
}
131131
}
@@ -137,7 +137,7 @@ function makeRequest(self, requestArgs, spec, overrideData) {
137137
opts.data,
138138
opts.auth,
139139
{headers: opts.headers},
140-
requestCallback,
140+
requestCallback
141141
);
142142
});
143143
}

lib/resources/EphemeralKeys.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = StripeResource.extend({
99
validator: function(data, options) {
1010
if (!options.headers || !options.headers['Stripe-Version']) {
1111
throw new Error(
12-
'stripe_version must be specified to create an ephemeral key',
12+
'stripe_version must be specified to create an ephemeral key'
1313
);
1414
}
1515
},

lib/resources/Files.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ module.exports = StripeResource.extend({
6161
'An error occurred while attempting to process the file for upload.',
6262
detail: error,
6363
}),
64-
null,
64+
null
6565
);
6666
};
6767
}

lib/stripe.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ Stripe.prototype = {
201201
setTimeout: function(timeout) {
202202
this._setApiField(
203203
'timeout',
204-
timeout == null ? Stripe.DEFAULT_TIMEOUT : timeout,
204+
timeout == null ? Stripe.DEFAULT_TIMEOUT : timeout
205205
);
206206
},
207207

lib/utils.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ var utils = (module.exports = {
105105
'Options found in arguments (' +
106106
optionKeysInArgs.join(', ') +
107107
'). Did you mean to pass an options ' +
108-
'object? See https://github.com/stripe/stripe-node/wiki/Passing-Options.',
108+
'object? See https://github.com/stripe/stripe-node/wiki/Passing-Options.'
109109
);
110110
}
111111

@@ -133,7 +133,7 @@ var utils = (module.exports = {
133133

134134
if (extraKeys.length) {
135135
emitWarning(
136-
'Invalid options found (' + extraKeys.join(', ') + '); ignoring.',
136+
'Invalid options found (' + extraKeys.join(', ') + '); ignoring.'
137137
);
138138
}
139139

@@ -246,7 +246,7 @@ var utils = (module.exports = {
246246
setTimeout(function() {
247247
callback(err, null);
248248
}, 0);
249-
},
249+
}
250250
);
251251
}
252252

@@ -323,7 +323,7 @@ var utils = (module.exports = {
323323
function emitWarning(warning) {
324324
if (typeof process.emitWarning !== 'function') {
325325
return console.warn(
326-
'Stripe: ' + warning,
326+
'Stripe: ' + warning
327327
); /* eslint-disable-line no-console */
328328
}
329329

0 commit comments

Comments
 (0)