- All the package-deps updated
- You can use koconut in browser env with bower
- To install, type
bower install [email protected]:ApexCaptain/Koconut.git
- Then, add src script to .html file
<!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <title>Your page title</title> <script src="bower_components/koconut/webpack/koconut.js"></script> </head> <body> ... </body> <script> KoconutArray.of(1, 2, 3, 4, 5) .onEach(alert) .process() .then(() => alert('Nailed it!')); </script> </html>
- To install, type
- Code coverage page added.
- Fix misspelled words in descriptive comments.
- Fix misspelled methods.
- Rename
mapVaues
tomapValues
of KoconutMap. - Rename
substract
tosubtract
of KoconutCollection. - Rename
runningFoldindexed
torunningFoldIndexed
of KoconutCollection.
- Rename
- Fix some methods that did not print out intelliSence description of method example source.
- Change the minimum Node.js version from 7 to 12 in order to follow node.js release and maintenance policy.
- API Document Page supports dark mode theme.
-
New base container class
KoconutBoolean
is added. It is a child class that extendsKoconutPrimitive<boolean>
and also implementsBoolean
of typescript. All the methods of other classes that returnKoconutPrimitive<boolean>
are replcaed with it. Documentization is still being processed. Supported methods are as following.compareTo
not
and
nand
or
nor
xor
xnor
eqv
-
New processor method
retrieve
is added to container classes. It simply processes all the chained objects and returns container instance itself. Please, have a check following example.const koconutBoolean = await new KoconutBoolean(true).retrieve(); console.log(koconutBoolean); // ↑ KoconutBoolean { isValidated: true, data: true }
-
Return type of
equalsTo
of protocolKoconutEquatable
is now also can beKoconutPrimitive<boolean>
orKoconutBoolean
.
-
Following methods are deprecated.
- `toArray` -- Commonly // `asArray` instead. - `toSet` -- Commonly // `asSet` instead. - `forEachIndexed` -- in `KoconutMap` - `onEachIndexed` -- in `KoconutMap`
-
New static creator method
generate
is added to container classes. It creates a new container instance with givencount
as number of elements and the values are provided by followinggenerator
function block with given ordered index as an argument . Please, have a check following example.const evenNumberArray = await KoconutArray.generate(5, (i) => i * 2).yield(); console.log(evenNumberArray); // ↑ [ 0, 2, 4, 6, 8 ] const evenNumberSet = await KoconutSet.generate(5, (i) => i * 2).yield(); console.log(evenNumberSet); // ↑ Set { 0, 2, 4, 6, 8 } const numberKeyStringValueMap = await KoconutMap.generate( 5, (i) => [i, i.toString()], // ↑ Also can be // new Pair(i, i.toString()) // Pair.from([i, i.toString()]) // new KoconutPair(i, i.toString()) // new Entry(i, i.toString()) // Entry.from([i, i.toString()]) // new KoconutEntry(i, i.toString()) ).yield(); console.log(numberKeyStringValueMap); // ↑ Map { 0 => '0', 1 => '1', 2 => '2', 3 => '3', 4 => '4' }
- Mapping and filtering methods of collections with specified target destination is now propery applied to
Set
when the value is instance of your custom class that inheritsKoconutEquatable
. Applied Methods -flatMapTo
-mapTo
-mapNotNullTo
-flatMapIndexedTo
-mapIndexedTo
-mapIndexedNotNullTo
-filterTo
-filterNotTo
-filterIndexedTo
-filterNotNullTo
- I'm planning to design 2 new data container classes for sequential and parallel promise chain. Those are quite similar to
Sequence
orStream
inJava
andKotlin
.
indexed
methods ofKoconutMap
are deprecated. It is not appropriate to let it be possible to use inMap
data structure. They'll remain until version1.0.15
.- Common caster methods
toArray
andtoSet
are deprecated. Instead, you can useasArray
orasSet
. Those have the same functionality. They'll remain until version1.0.15
.
- API documentation of
KoconutMap
is completed.
- Babel@runtime is now moved to common dependencies section. I'm sorry I didn't catch that.
-
Creation of container classes allows
null
as its argument and also use it as default value. When it is omitted, it'll return an empty collection instance.new KoconutArray(); KoconutArray.of(); KoconutArray.from(); // An empty array. new KoconutSet(); KoconutSet.of(); KoconutSet.from(); // An empty set. new KoconutMap(); KcoonutMap.of(); KoconutMap.from(); // An empty map.
If you're using TypeScript, it is recommended to declare generic type explicitly.
- README for NPM is now separated. Not very different from the original README.md. Since the column on NPM README is quite narrow and table of contents navigation does not work properly. I think it's because anchor links are generated differently on GitHub and NPM. I'll only leave brief introductions and examples in the NPM README.
- Iterative functions, such as
forEach
,forEachIndexed
,onEach
andonEachIndexed
now can be interrupted withKoconutLoopSignal.BREAK
. Of course it is still available by simpleboolean
. To stop the iteration in the mean time, you can simplyreturn false
orreturn KoconutLoopSignal.BREAK
. You can check example if you want to.
- Deprecation Warning functionality is now available
- README.md and CHANGELOG.md files added.
- All the classes, methods, protocols or etc are currently being documentized and available from now on. There are still lots of work to do though... You can check'em here.