customcommander / customcommander/functionaut
at
- Lingua principale
- JavaScript
- Stelle
- 1
- Fork
- 0
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
# `at(i, x)`
> Returns value at given key, index or path in an array or object or combination of both.
Where:
- `i` is a string, a number or an array of strings or numbers
- `x` is either an array or an object
## Examples
### Value from an array
```javascript
at(1)([41, 42, 43]);
//=> 42
```
### Value from a object
```javascript
at('answer')({answer: 42});
//=> 42
```
### Value from a nested array
```javascript
at([1, 1])([[31, 32], [41, 42]]);
//=> 42
```
### Value from an object in a nested array
```javascript
at([1, 'answer'])([[{}], [{answer: 42}]]);
//=> 42
```
## Features
- [ ] Function must be curried.
- [ ] When given an array recursively go down `x`
- [ ] Should avoid null pointer exception by conceding as soon as nil (i.e. either `null` or `undefined`) is detected.
- [ ] Return either nil or the value at `i`.
- [ ] Should not read from the prototype e.g. `at('length', [1, 2, 3])` should return `undefined` not `3`.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Parti dall’entry point `at(i, x)` e usa gli esempi per seguire i lookup di array, oggetti e strutture annidate. Il lavoro è completo quando la funzione è curried, accetta le forme di chiave elencate, si ferma su null o undefined, restituisce il valore richiesto o nil e non legge dai prototipi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- tooling
- Tipo di issue
- Funzionalità
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 50/100