-
Notifications
You must be signed in to change notification settings - Fork 3
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 #123 from dhershman1/development
Development v0.14.0
- Loading branch information
Showing
15 changed files
with
108 additions
and
103 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
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
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
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
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,34 @@ | ||
import compose from '../function/compose' | ||
import _curry2 from '../_internals/_curry2' | ||
import deepEq from '../function/deepEq' | ||
import slice from './slice' | ||
|
||
/** | ||
* @name startsWith | ||
* @function | ||
* @since v0.14.0 | ||
* @category List | ||
* @sig | ||
* a -> List -> Boolean | ||
* String -> String -> Boolean | ||
* @description Checks to see if the provided value is at the beginning of a given list | ||
* @param {String|Array} a The value to check for at the beginning of the list | ||
* @param {String|Array} list The list to check through | ||
* @return {Boolean} If the value is at the end of the provided list | ||
* @example | ||
* import { startsWith } from 'kyanite' | ||
* | ||
* startsWith('c' , 'cab') // => true | ||
* startsWith(['c'], ['c', 'b', 'a']) // => true | ||
* startsWith('b', 'abc') // => false | ||
* startsWith(['b'], ['a', 'b', 'c']) // => false | ||
* | ||
* // It's also curried | ||
* const fn = startsWith('c') | ||
* | ||
* fn('cab') // => true | ||
* fn('abc') // => false | ||
*/ | ||
const startsWith = (a, list) => compose(deepEq(a), slice(0, a.length), list) | ||
|
||
export default _curry2(startsWith) |
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 was deleted.
Oops, something went wrong.
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,18 @@ | ||
import startsWith from '../../src/list/startsWith' | ||
import test from 'tape' | ||
|
||
test('startsWith -- Basic Usage on lists', t => { | ||
t.true(startsWith('c', 'cab')) | ||
t.true(startsWith(['a'], ['a', 'b', 'c'])) | ||
t.false(startsWith('b', 'abc')) | ||
t.end() | ||
}) | ||
|
||
test('startsWith -- Is curried', t => { | ||
const fn = startsWith('c') | ||
|
||
t.true(fn('cab')) | ||
t.true(fn('c')) | ||
t.false(fn('a')) | ||
t.end() | ||
}) |
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