Skip to content

Commit

Permalink
Updated API docs
Browse files Browse the repository at this point in the history
  • Loading branch information
klaudiosinani committed Nov 17, 2018
1 parent 40a007b commit 7558c6a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/api.EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,27 @@ isEmpty(ones(1)) //=> false
isEmpty('foo') //=> false
```
#### `insert(idx, x, xs)`
- idx: `Number`
- x: `Any`
- xs: `Array|String`
- Returns: `Array|String`
- Curried: `True`
- Added on: `0.3.0`
- [Go to source](https://github.com/klauscfhq/arare/tree/master/src/insert.js)
Accepts a number `idx`, a value `x`, an array or a string `xs`, and returns a shallow copy of `xs`, that contains the value `x`, inserted at the position corresponding to the index `idx`.
```js
insert(0, 20, []) //=> [20]
insert(0, 20, '') //=> '20'
insert(2, 20, range(1, 5, 1)) //=> [1, 2, 20, 3, 4]
insert(2)(20)(range(1)(6)(1)) //=> [1, 2, 20, 3, 4]
insert(3, '-', 'foobar') //=> 'foo-bar'
insert(3)('-')('foobar') //=> 'foo-bar'
```
#### `isFn(x)`
- x: `Any`
Expand Down
2 changes: 2 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ An alphabetically ordered list of all available functions can be found [**here**
- [`flatten`](docs/api.EN.md#flattenxs)
- [`halve`](docs/api.EN.md#halvexs)
- [`init`](docs/api.EN.md#initxs)
- [`insert`](docs/api.EN.md#insertidx-x-xs)
- [`keys`](docs/api.EN.md#keysobj)
- [`map`](docs/api.EN.md#mapfn-xs)
- [`mapcat`](docs/api.EN.md#mapcatfn-xs)
Expand Down Expand Up @@ -372,6 +373,7 @@ An alphabetically ordered list of all available functions can be found [**here**
- [`erase`](docs/api.EN.md#erasei-j-xs)
- [`halve`](docs/api.EN.md#halvexs)
- [`init`](docs/api.EN.md#initxs)
- [`insert`](docs/api.EN.md#insertidx-x-xs)
- [`join`](docs/api.EN.md#joinx-xs)
- [`partition`](docs/api.EN.md#partitionfn-xs)
- [`partitionAt`](docs/api.EN.md#partitionAtidx-xs)
Expand Down

0 comments on commit 7558c6a

Please sign in to comment.