From 8d8a8f2b8e371290a046d7d741e65efe3a2ba2ec Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 13 May 2021 15:59:33 +0300 Subject: [PATCH] docs... Signed-off-by: Alex A. Naanou --- README.md | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 6f886f4..68102f2 100644 --- a/README.md +++ b/README.md @@ -79,13 +79,13 @@ A library of JavaScript type extensions, types and type utilities. - [`.slice(..)`](#generatorslice) - [`.at(..)` / `.gat(..)`](#generatorat--generatorgat) - [`.flat(..)`](#generatorflat) - - [`.shift()` / `.pop()`](#generatorshift--generatorpop) + - [`.shift()` / `.pop()` / `.gshift()` / `.gpop()`](#generatorshift--generatorpop--generatorgshift--generatorgpop) - [`.promise()`](#generatorpromise) - [`.then(..)` / `.catch(..)` / `.finally(..)`](#generatorthen--generatorcatch--generatorfinally) - [`.toArray()`](#generatortoarray) - [Generator constructor iteration](#generator-constructor-iteration) - [`.at(..)` / `.gat(..)`](#generatorat--generatorgat-1) - - [`.shift()` / `.pop()` / `.gshift()` / `.gpop()`](#generatorshift--generatorpop--generatorgshift--generatorgpop) + - [`.shift()` / `.pop()` / `.gshift()` / `.gpop()`](#generatorshift--generatorpop--generatorgshift--generatorgpop-1) - [`.slice(..)`](#generatorslice-1) - [`.map(..)` / `.filter(..)` / `.reduce(..)` / `.flat()`](#generatormap--generatorfilter--generatorreduce--generatorflat) - [`.toArray()`](#generatortoarray-1) @@ -1688,24 +1688,29 @@ array, for more info see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/flat -#### `.shift()` / `.pop()` +#### `.shift()` / `.pop()` / `.gshift()` / `.gpop()` Return the first/last item in generator. ```bnf +.shift() .pop() -> -> undefined +``` -.shift() - -> - -> undefined +Return a `` that will yield the first/last item in the generator. +```bnf +.gshift() +.gpop() + -> ``` Note that there are no equivalents to `.push(..)` and `.unshift(..)` as they would require breaking item processing order. -Note that `.shift()` may not yield the actual first item if the generator is -partially depleted at time of call. +Note that `.shift()`/`.gshift()` will yield the item the generator is at at +time of call, this may not be the _first_ item if the generator is partially +depleted. #### `.promise()` @@ -1821,7 +1826,8 @@ XXX list the differences... -> ``` - +Equivalents to [``'s `.at(..)`/`.gat(..)`](#generatorat--generatorgat) +but returning a reusable ``/``. #### `.shift()` / `.pop()` / `.gshift()` / `.gpop()` @@ -1839,7 +1845,8 @@ XXX list the differences... Note that `.shift()`/`.gshift()` will get the element the generator is at currently which may not be the first element in the sequence. - +Equivalents to [``'s `.shift(..)`/`.pop(..)`/..](#generatorshift--generatorpop--generatorgshift--generatorgpop) +but returning a reusable ``/``. #### `.slice(..)` @@ -1850,7 +1857,10 @@ currently which may not be the first element in the sequence. -> ``` -This is like `Array`'s `.slice(..)` but does not support negative indexes. +Unlike `Array`'s `.slice(..)` this does not support negative indexes. + +Equivalent to [``'s `.slice(..)`](#generatorslice) +but returning a reusable ``. #### `.map(..)` / `.filter(..)` / `.reduce(..)` / `.flat()` @@ -1879,7 +1889,7 @@ or, to only import containers: var containers = require('ig-types/containers') ``` -Note that this will also import `ig-types/Map`. +Note that this will also import [`ig-types/Map`](#map). ### `containers.UniqueKeyMap()` (`Map`)