Skip to content

Commit

Permalink
chore@small
Browse files Browse the repository at this point in the history
  • Loading branch information
selfrefactor committed Mar 11, 2024
1 parent ef099f5 commit 17fcd4f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .github/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4150,6 +4150,8 @@ function parseRegex(maybeRegex){
export function equals(a, b){
if (arguments.length === 1) return _b => equals(a, _b)

if (Object.is(a, b)) return true

const aType = type(a)

if (aType !== type(b)) return false
Expand Down Expand Up @@ -4554,7 +4556,7 @@ describe('brute force', () => {
{
"ERRORS_MESSAGE_MISMATCH": 0,
"ERRORS_TYPE_MISMATCH": 0,
"RESULTS_MISMATCH": 8,
"RESULTS_MISMATCH": 0,
"SHOULD_NOT_THROW": 0,
"SHOULD_THROW": 0,
"TOTAL_TESTS": 289,
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3925,6 +3925,8 @@ function parseRegex(maybeRegex){
export function equals(a, b){
if (arguments.length === 1) return _b => equals(a, _b)

if (Object.is(a, b)) return true

const aType = type(a)

if (aType !== type(b)) return false
Expand Down Expand Up @@ -4329,7 +4331,7 @@ describe('brute force', () => {
{
"ERRORS_MESSAGE_MISMATCH": 0,
"ERRORS_TYPE_MISMATCH": 0,
"RESULTS_MISMATCH": 8,
"RESULTS_MISMATCH": 0,
"SHOULD_NOT_THROW": 0,
"SHOULD_THROW": 0,
"TOTAL_TESTS": 289,
Expand Down
14 changes: 5 additions & 9 deletions src/unless.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import { curry } from './curry.js'
export function unless(predicate, whenFalse){
if (arguments.length === 1){
return _whenFalse => unless(predicate, _whenFalse)
}

function unlessFn(
predicate, whenFalseFn, input
){
if (predicate(input)) return input

return whenFalseFn(input)
return input => predicate(input) ? input : whenFalse(input)
}

export const unless = curry(unlessFn)

0 comments on commit 17fcd4f

Please sign in to comment.