This repository has been archived by the owner on Jul 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Home
hb432 edited this page Apr 1, 2021
·
3 revisions
This page documents the methods and functions available in this package, given that variable core
refers to require('@grakkit/core')
.
- Returns:
<any[]>
Converts Java Iterables, Java Iterators, and Java Spliterators into JavaScript Arrays. If a JavaScript array is passed, a clone is created and returned. If none of the above is passed, returns null
.
- Returns:
<void>
base
is any value. modifier
is a function with 2 arguments -- input
is a value, which refers to base
the first time modifier
is called, and callback
is a function which takes a new value and passes it back through modifier
as well as a new callback.
Example: Log all properties of an object recursively
// test variable
const test = { a: 'b', c: 'd', e: [ 'f', 'g', { h: 'i', j: 'k', l: 'm' } ] };
// top-level call
core.chain(test, (input, callback) => {
if (typeof input === 'object') {
// pass properties back into modifier
if (typeof input[Symbol.iterator] === 'function') {
for (const value of input) callback(value);
} else {
for (const value of Object.values(input)) callback(value);
}
} else {
// log non-object input to console
console.log(input);
}
});
- Returns:
<any>
Does a very epic thing (need to write description)