Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/aviate-labs/array.mo

Extended Array Package for Motoko
https://github.com/aviate-labs/array.mo

Last synced: 21 days ago
JSON representation

Extended Array Package for Motoko

Awesome Lists containing this project

README

        

# Array

Contains some (complementing) functions in addition to `mo:base/Array`.

## Usage

### Contains

Checks whether an array contains a given value.

```motoko
contains : (xs : [T], y : T, equal : (T, T) -> Bool) -> Bool
```

### Drop

Drops the first 'n' elements of an array, returns the remainder of that array.

```motoko
drop : (xs : [T], n : Nat) -> [T]
```

### Split

Splits an array in two parts, based on the given element index.

```motoko
split : (xs : [T], n : Nat) -> ([T], [T])
```

### Take

Returns the first 'n' elements of an array.

```motoko
take : (xs : [T], n : Nat) -> [T]
```