Skip to content

Commit ea6846a

Browse files
committed
meta tweaks
1 parent 066439e commit ea6846a

File tree

5 files changed

+62
-65
lines changed

5 files changed

+62
-65
lines changed

.gitattributes

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

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
sudo: false
22
language: node_js
33
node_js:
4-
- '5'
4+
- '6'
55
- '4'
66
- '0.12'
77
- '0.10'

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "object-assign",
33
"version": "4.1.0",
4-
"description": "ES2015 Object.assign() ponyfill",
4+
"description": "ES2015 `Object.assign()` ponyfill",
55
"license": "MIT",
66
"repository": "sindresorhus/object-assign",
77
"author": {
@@ -13,7 +13,7 @@
1313
"node": ">=0.10.0"
1414
},
1515
"scripts": {
16-
"test": "xo && mocha",
16+
"test": "xo && ava",
1717
"bench": "matcha bench.js"
1818
},
1919
"files": [
@@ -34,9 +34,9 @@
3434
"browser"
3535
],
3636
"devDependencies": {
37+
"ava": "^0.16.0",
3738
"lodash": "^4.8.2",
3839
"matcha": "^0.7.0",
39-
"mocha": "*",
4040
"xo": "*"
4141
}
4242
}

readme.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# object-assign [![Build Status](https://travis-ci.org/sindresorhus/object-assign.svg?branch=master)](https://travis-ci.org/sindresorhus/object-assign)
22

3-
> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) ponyfill
4-
5-
> Ponyfill: A polyfill that doesn't overwrite the native method
3+
> ES2015 [`Object.assign()`](http://www.2ality.com/2014/01/object-assign.html) [ponyfill](https://ponyfill.com)
64
75

86
## Install
@@ -36,7 +34,7 @@ objectAssign({foo: 0}, null, {bar: 1}, undefined);
3634

3735
## API
3836

39-
### objectAssign(target, source, [source, ...])
37+
### objectAssign(target, [source, ...])
4038

4139
Assigns enumerable own properties of `source` objects to the `target` object and returns the `target` object. Additional `source` objects will overwrite previous ones.
4240

test.js

Lines changed: 55 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,129 @@
1-
'use strict';
2-
/* eslint-env mocha */
3-
var assert = require('assert');
1+
import test from 'ava';
42

5-
Object.assign = undefined;
6-
var objectAssign = require('./');
3+
Object.assign = require('./');
4+
const objectAssign = require('./');
75

8-
it('should have the correct length', function () {
9-
assert.equal(objectAssign.length, 2);
6+
test('have the correct length', t => {
7+
t.is(objectAssign.length, 2);
108
});
119

12-
it('should throw when target is not an object', function () {
13-
assert.throws(function () {
10+
test('throw when target is not an object', t => {
11+
t.throws(() => {
1412
objectAssign(null);
1513
}, TypeError);
16-
assert.throws(function () {
14+
t.throws(() => {
1715
objectAssign(undefined);
1816
}, TypeError);
1917
});
2018

21-
it('should objectAssign own enumerable properties from source to target object', function () {
22-
assert.deepEqual(objectAssign({foo: 0}, {bar: 1}), {
19+
test('objectAssign own enumerable properties from source to target object', t => {
20+
t.deepEqual(objectAssign({foo: 0}, {bar: 1}), {
2321
foo: 0,
2422
bar: 1
2523
});
26-
assert.deepEqual(objectAssign({foo: 0}, null, undefined), {foo: 0});
27-
assert.deepEqual(objectAssign({foo: 0}, null, undefined, {bar: 1}, null), {
24+
t.deepEqual(objectAssign({foo: 0}, null, undefined), {foo: 0});
25+
t.deepEqual(objectAssign({foo: 0}, null, undefined, {bar: 1}, null), {
2826
foo: 0,
2927
bar: 1
3028
});
3129
});
3230

33-
it('should throw on null/undefined target', function () {
34-
assert.throws(function () {
31+
test('throw on null/undefined target', t => {
32+
t.throws(() => {
3533
objectAssign(null, {});
3634
});
3735

38-
assert.throws(function () {
36+
t.throws(() => {
3937
objectAssign(undefined, {});
4038
});
4139

42-
assert.throws(function () {
40+
t.throws(() => {
4341
objectAssign(undefined, undefined);
4442
});
4543
});
4644

47-
it('should not throw on null/undefined sources', function () {
48-
assert.doesNotThrow(function () {
45+
test('not throw on null/undefined sources', t => {
46+
t.notThrows(() => {
4947
objectAssign({}, null);
5048
});
5149

52-
assert.doesNotThrow(function () {
50+
t.notThrows(() => {
5351
objectAssign({}, undefined);
5452
});
5553

56-
assert.doesNotThrow(function () {
54+
t.notThrows(() => {
5755
objectAssign({}, undefined, null);
5856
});
5957
});
6058

61-
it('should support multiple sources', function () {
62-
assert.deepEqual(objectAssign({foo: 0}, {bar: 1}, {bar: 2}), {
59+
test('support multiple sources', t => {
60+
t.deepEqual(objectAssign({foo: 0}, {bar: 1}, {bar: 2}), {
6361
foo: 0,
6462
bar: 2
6563
});
66-
assert.deepEqual(objectAssign({}, {}, {foo: 1}), {foo: 1});
64+
t.deepEqual(objectAssign({}, {}, {foo: 1}), {foo: 1});
6765
});
6866

69-
it('should only iterate own keys', function () {
70-
var Unicorn = function () {};
67+
test('only iterate own keys', t => {
68+
const Unicorn = function () {};
7169
Unicorn.prototype.rainbows = 'many';
72-
var unicorn = new Unicorn();
70+
const unicorn = new Unicorn();
7371
unicorn.bar = 1;
7472

75-
assert.deepEqual(objectAssign({foo: 1}, unicorn), {
73+
t.deepEqual(objectAssign({foo: 1}, unicorn), {
7674
foo: 1,
7775
bar: 1
7876
});
7977
});
8078

81-
it('should return the modified target object', function () {
82-
var target = {};
83-
var returned = objectAssign(target, {a: 1});
84-
assert.equal(returned, target);
79+
test('return the modified target object', t => {
80+
const target = {};
81+
const returned = objectAssign(target, {a: 1});
82+
t.is(returned, target);
8583
});
8684

87-
it('should support `Object.create(null)` objects', function () {
88-
var obj = Object.create(null);
85+
test('support `Object.create(null)` objects', t => {
86+
const obj = Object.create(null);
8987
obj.foo = true;
90-
assert.deepEqual(objectAssign({}, obj), {foo: true});
88+
t.deepEqual(objectAssign({}, obj), {foo: true});
9189
});
9290

93-
it('should preserve property order', function () {
94-
var letters = 'abcdefghijklmnopqrst';
95-
var source = {};
96-
letters.split('').forEach(function (letter) {
91+
test('preserve property order', t => {
92+
const letters = 'abcdefghijklmnopqrst';
93+
const source = {};
94+
letters.split('').forEach(letter => {
9795
source[letter] = letter;
9896
});
99-
var target = objectAssign({}, source);
100-
assert.equal(Object.keys(target).join(''), letters);
97+
const target = objectAssign({}, source);
98+
t.is(Object.keys(target).join(''), letters);
10199
});
102100

103-
it('should accept primitives as target', function () {
104-
var target = objectAssign('abcdefg', {foo: 'bar'});
105-
var strObj = Object('abcdefg');
101+
test('accept primitives as target', t => {
102+
const target = objectAssign('abcdefg', {foo: 'bar'});
103+
const strObj = Object('abcdefg');
106104
strObj.foo = 'bar';
107-
assert.deepEqual(target, strObj);
105+
t.deepEqual(target, strObj);
108106
});
109107

110-
if (typeof Symbol !== 'undefined') {
111-
it('should support symbol properties', function () {
112-
var target = {};
113-
var source = {};
114-
var sym = Symbol('foo');
108+
if (typeof global.Symbol !== 'undefined') {
109+
test('support symbol properties', t => {
110+
const target = {};
111+
const source = {};
112+
const sym = Symbol('foo');
115113
source[sym] = 'bar';
116114
objectAssign(target, source);
117-
assert.equal(target[sym], 'bar');
115+
t.is(target[sym], 'bar');
118116
});
119117

120-
it('should only copy enumerable symbols', function () {
121-
var target = {};
122-
var source = {};
123-
var sym = Symbol('foo');
118+
test('only copy enumerable symbols', t => {
119+
const target = {};
120+
const source = {};
121+
const sym = Symbol('foo');
124122
Object.defineProperty(source, sym, {
125123
enumerable: false,
126124
value: 'bar'
127125
});
128126
objectAssign(target, source);
129-
assert.equal(target[sym], undefined);
127+
t.is(target[sym], undefined);
130128
});
131129
}

0 commit comments

Comments
 (0)