Skip to content

Commit

Permalink
chore@sync major bump
Browse files Browse the repository at this point in the history
  • Loading branch information
selfrefactor committed Aug 19, 2019
1 parent 4b20dcd commit 65acf77
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 44 deletions.
2 changes: 2 additions & 0 deletions files/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# CHANGELOG

2.14.0 `R.nextIndex` and `R.prevIndex` work also with number as second argument

2.13.0 Deprecate `R.log` and `R.runTests`

2.12.3 Add 'dist' directory to `files`
Expand Down
1 change: 0 additions & 1 deletion rambdax.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ export * from './src/rambda/complement'
export { complement as opposite } from './src/rambda/complement'
export * from './src/rambda/compose'
export * from './src/rambda/concat'
export * from './src/rambda/contains'
export * from './src/rambda/curry'
export * from './src/rambda/dec'
export * from './src/rambda/defaultTo'
Expand Down
35 changes: 0 additions & 35 deletions src/rambda/contains.js

This file was deleted.

18 changes: 14 additions & 4 deletions src/rambda/includes.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { equals } from './equals'
/**
* Returns `true` if the specified value is equal, in [`R.equals`](#equals)
* terms, to at least one element of the given list; `false` otherwise.
Expand All @@ -18,11 +19,20 @@
* R.includes('ba', 'banana'); //=>true
*/
export function includes(target, list){
if (arguments.length === 1) return _list => includes(target, _list)
if (arguments.length === 1) return _input => includes(target, _input)

const ok = Array.isArray(list) || typeof list === 'string'
if (typeof list === 'string'){
return list.includes(target)
}
if (!Array.isArray(list)) return false

if (!ok) return false
let index = -1

return list.includes(target)
while (++index < list.length){
if (equals(list[ index ], target)){
return true
}
}

return false
}
4 changes: 2 additions & 2 deletions src/rambda/uniq.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { contains } from './contains'
import { includes } from './includes'

/**
* Returns a new list containing only one copy of each element in the original
Expand All @@ -22,7 +22,7 @@ export function uniq(list){
while (++index < list.length){
const value = list[ index ]

if (!contains(value, willReturn)){
if (!includes(value, willReturn)){
willReturn.push(value)
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/rambda/without.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { contains } from './contains'
import { includes } from './includes'
import { reduce } from './reduce'

/**
Expand All @@ -24,7 +24,7 @@ export function without(left, right){

return reduce(
(accum, item) =>
contains(item, left) ? accum : accum.concat(item),
includes(item, left) ? accum : accum.concat(item),
[],
right
)
Expand Down

0 comments on commit 65acf77

Please sign in to comment.