-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #282 from Bradcomp/on
Added function S.on
- Loading branch information
Showing
3 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
var S = require('..'); | ||
|
||
var eq = require('./internal/eq'); | ||
var rem = require('./internal/rem'); | ||
|
||
|
||
describe('on', function() { | ||
|
||
it('is a quaternary function', function() { | ||
eq(typeof S.on, 'function'); | ||
eq(S.on.length, 4); | ||
}); | ||
|
||
it('passes the last two arguments through the modifying function into the converging function', function() { | ||
eq(S.on(rem, S.prop('x'), {x: 5, y: 5}, {x: 3, y: 3}), 2); | ||
eq(S.on(S.concat, S.reverse)([1, 2, 3], [4, 5, 6]), [3, 2, 1, 6, 5, 4]); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
'use strict'; | ||
|
||
var S = require('..'); | ||
|
||
var eq = require('./internal/eq'); | ||
var rem_ = require('./internal/rem_'); | ||
|
||
|
||
describe('on_', function() { | ||
|
||
it('is a quaternary function', function() { | ||
eq(typeof S.on_, 'function'); | ||
eq(S.on_.length, 4); | ||
}); | ||
|
||
it('passes the last two arguments through the modifying function into the converging function', function() { | ||
eq(S.on_(rem_, S.prop('x'), {x: 5, y: 5}, {x: 3, y: 3}), 2); | ||
}); | ||
|
||
}); |