Skip to content

Commit 42cc3bf

Browse files
committed
Require Node.js 6
1 parent fe1feb2 commit 42cc3bf

3 files changed

Lines changed: 56 additions & 54 deletions

File tree

.gitattributes

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
* text=auto
2-
*.js text eol=lf
1+
* text=auto eol=lf

bench.js

Lines changed: 54 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,57 @@
11
'use strict';
2-
32
const Benchmark = require('benchmark');
43
const m = require('.');
54

65
const suite = new Benchmark.Suite();
76

8-
suite.add('get', () => {
9-
const f1 = {foo: {bar: 1}};
10-
m.get(f1);
11-
f1[''] = 'foo';
12-
m.get(f1, '');
13-
m.get(f1, 'foo');
14-
m.get({foo: 1}, 'foo');
15-
m.get({foo: null}, 'foo');
16-
m.get({foo: undefined}, 'foo');
17-
m.get({foo: {bar: true}}, 'foo.bar');
18-
m.get({foo: {bar: {baz: true}}}, 'foo.bar.baz');
19-
m.get({foo: {bar: {baz: null}}}, 'foo.bar.baz');
20-
m.get({foo: {bar: 'a'}}, 'foo.fake');
21-
m.get({foo: {bar: 'a'}}, 'foo.fake.fake2');
22-
m.get({'\\': true}, '\\');
23-
m.get({'\\foo': true}, '\\foo');
24-
m.get({'bar\\': true}, 'bar\\');
25-
m.get({'foo\\bar': true}, 'foo\\bar');
26-
m.get({'\\.foo': true}, '\\\\.foo');
27-
m.get({'bar\\.': true}, 'bar\\\\.');
28-
m.get({'foo\\.bar': true}, 'foo\\\\.bar');
29-
30-
const f2 = {};
31-
Object.defineProperty(f2, 'foo', {
32-
value: 'bar',
33-
enumerable: false
34-
});
35-
m.get(f2, 'foo');
36-
m.get({}, 'hasOwnProperty');
37-
38-
function fn() {}
39-
fn.foo = {bar: 1};
40-
m.get(fn);
41-
m.get(fn, 'foo');
42-
m.get(fn, 'foo.bar');
43-
44-
const f3 = {foo: null};
45-
m.get(f3, 'foo.bar');
46-
47-
m.get({'foo.baz': {bar: true}}, 'foo\\.baz.bar');
48-
m.get({'fo.ob.az': {bar: true}}, 'fo\\.ob\\.az.bar');
49-
50-
m.get(null, 'foo.bar', false);
51-
m.get('foo', 'foo.bar', false);
52-
m.get([], 'foo.bar', false);
53-
m.get(undefined, 'foo.bar', false);
54-
})
7+
suite
8+
.add('get', () => {
9+
const f1 = {foo: {bar: 1}};
10+
m.get(f1);
11+
f1[''] = 'foo';
12+
m.get(f1, '');
13+
m.get(f1, 'foo');
14+
m.get({foo: 1}, 'foo');
15+
m.get({foo: null}, 'foo');
16+
m.get({foo: undefined}, 'foo');
17+
m.get({foo: {bar: true}}, 'foo.bar');
18+
m.get({foo: {bar: {baz: true}}}, 'foo.bar.baz');
19+
m.get({foo: {bar: {baz: null}}}, 'foo.bar.baz');
20+
m.get({foo: {bar: 'a'}}, 'foo.fake');
21+
m.get({foo: {bar: 'a'}}, 'foo.fake.fake2');
22+
m.get({'\\': true}, '\\');
23+
m.get({'\\foo': true}, '\\foo');
24+
m.get({'bar\\': true}, 'bar\\');
25+
m.get({'foo\\bar': true}, 'foo\\bar');
26+
m.get({'\\.foo': true}, '\\\\.foo');
27+
m.get({'bar\\.': true}, 'bar\\\\.');
28+
m.get({'foo\\.bar': true}, 'foo\\\\.bar');
29+
30+
const f2 = {};
31+
Object.defineProperty(f2, 'foo', {
32+
value: 'bar',
33+
enumerable: false
34+
});
35+
m.get(f2, 'foo');
36+
m.get({}, 'hasOwnProperty');
37+
38+
function fn() {}
39+
fn.foo = {bar: 1};
40+
m.get(fn);
41+
m.get(fn, 'foo');
42+
m.get(fn, 'foo.bar');
43+
44+
const f3 = {foo: null};
45+
m.get(f3, 'foo.bar');
46+
47+
m.get({'foo.baz': {bar: true}}, 'foo\\.baz.bar');
48+
m.get({'fo.ob.az': {bar: true}}, 'fo\\.ob\\.az.bar');
49+
50+
m.get(null, 'foo.bar', false);
51+
m.get('foo', 'foo.bar', false);
52+
m.get([], 'foo.bar', false);
53+
m.get(undefined, 'foo.bar', false);
54+
})
5555
.add('set', () => {
5656
const func = () => 'test';
5757
let f1 = {};
@@ -156,8 +156,11 @@ suite.add('get', () => {
156156

157157
m.has({'foo.baz': {bar: true}}, 'foo\\.baz.bar');
158158
m.has({'fo.ob.az': {bar: true}}, 'fo\\.ob\\.az.bar');
159-
}).on('cycle', event => {
159+
})
160+
.on('cycle', event => {
160161
console.log(String(event.target));
161-
}).on('complete', () => {
162+
})
163+
.on('complete', () => {
162164
console.log('Finished');
163-
}).run({async: true});
165+
})
166+
.run({async: true});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"url": "sindresorhus.com"
1111
},
1212
"engines": {
13-
"node": ">=4"
13+
"node": ">=6"
1414
},
1515
"scripts": {
1616
"test": "xo && ava",

0 commit comments

Comments
 (0)