Skip to content

Commit

Permalink
reverse syntax to work better with lists
Browse files Browse the repository at this point in the history
  • Loading branch information
pemrouz committed May 15, 2015
1 parent aa62fca commit 5e6d632
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.js
Expand Up @@ -3,8 +3,8 @@ var is = require('is')
, keys = require('keys')
, copy = require('copy')

module.exports = function extend(from){
return function(to){
module.exports = function extend(to){
return function(from){
keys(from)
.filter(not(is.in(to)))
.map(copy(from, to))
Expand Down
4 changes: 2 additions & 2 deletions test.js
Expand Up @@ -5,14 +5,14 @@ describe('extend', function() {

it('should copy values', function() {
var from = { a: 1, b: 2 }, to = {}
expect(extend(from)(to)).to.equal(to)
expect(extend(to)(from)).to.equal(to)
expect(from).to.eql({ a: 1, b: 2 })
expect(from).to.eql(to)
})

it('should not override values', function() {
var from = { a: 1, b: 2 }, to = { a: 3 }
extend(from)(to)
extend(to)(from)
expect(to).to.eql({ a: 3, b: 2 })
})

Expand Down

0 comments on commit 5e6d632

Please sign in to comment.