Skip to content

Commit 44e02a8

Browse files
committed
run stardard code style
1 parent 486cb0a commit 44e02a8

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

benchmark.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var Benchmark = require('benchmark')
2-
var Suite = new Benchmark.Suite
2+
var Suite = new Benchmark.Suite()
33
var insert = require('./index.js')
44

55
var testString = 'abcdefg'

index.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
* @returns {Array|String} New modified value depending on `input` type.
77
*/
88
module.exports = function (input, value, index) {
9-
var isStringInput = typeof input === 'string'
10-
if (!isStringInput && !Array.isArray(input))
9+
const isStringInput = typeof input === 'string'
10+
if (!isStringInput && !Array.isArray(input)) {
1111
throw new TypeError('First argument invalid. Expected Array or String.')
12-
if (typeof index !== 'undefined' && typeof index !== 'number')
12+
}
13+
if (typeof index !== 'undefined' && typeof index !== 'number') {
1314
throw new TypeError('Third argument invalid. Expected Number.')
14-
// Avoid negative index offset
15-
var beacon = index || 0
15+
}
16+
const beacon = index || 0
1617
// concat([value]) is faster than concat(value) for String, Number and Object
17-
var insert = (Array.isArray(value) || isStringInput)? value: [value]
18+
const insert = (Array.isArray(value) || isStringInput) ? value : [value]
1819
return input.slice(0, beacon).concat(insert).concat(input.slice(beacon))
1920
}

0 commit comments

Comments
 (0)