https://github.com/oktopost/plankton
https://github.com/oktopost/plankton
Last synced: 8 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/oktopost/plankton
- Owner: Oktopost
- Created: 2017-01-08T07:36:40.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2022-11-17T12:26:58.000Z (over 3 years ago)
- Last Synced: 2025-03-08T08:17:07.691Z (over 1 year ago)
- Language: JavaScript
- Size: 79.1 KB
- Stars: 2
- Watchers: 14
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Plankton
[](https://www.npmjs.com/package/oktopost-plankton)
[](https://travis-ci.org/Oktopost/plankton)
[](https://coveralls.io/github/Oktopost/plankton?branch=master)
Additional standalone libraries
* [`oktopost-plankton-url`](./docs/plankton/url.md)
## Installation and Usage
```
npm install oktopost-plankton --save
```
* In node
```js
const is = require('oktopost-plankton').is;
const obj = require('oktopost-plankton').obj;
const foreach = require('oktopost-plankton').foreach;
if (is.defined(myArray))
{
foreach.key(myArray, function (index)
{
console.log('Got index ' + index);
});
foreach(myArray, function (value)
{
console.log('Got value ' + value);
});
}
let myCollectionKeys = obj.keys(myCollection);
```
* In web Plankton library is registered under `window.Plankton` and can be used as following:
```js
var is = window.Plankton.is;
var obj = window.Plankton.obj;
var foreach = window.Plankton.foreach;
if (is.defined(myArray))
{
foreach.key(myArray, function (index)
{
console.log('Got index ' + index);
});
foreach(myArray, function (value)
{
console.log('Got value ' + value);
});
}
var myCollectionKeys = obj.keys(myCollection);
```