Some utilities used by various cyclon.p2p modules
First install cyclon.p2p-common as a runtime dependency
npm install cyclon.p2p-common --save
Then include the library using require
var cyclonUtils = require('cyclon.p2p-common');
Select a random sample of items from an array using reservoir sampling.
- inputArray The array to sample from.
- sampleSize The number of items to sample.
Check that an arguments array contains the expected number of items, throw an Error otherwise.
- argumentsArray The arguments array to check.
- expectedCount The expected size of the arguments array.
Get the singleton ConsoleLogger instance.
Create instances of an in-memory implementation of the DOM storage API.
Get the singleton instance of the AsyncExecService interface that's used in a lot of places.
Decorate implementations of the DOM storage API with an obfuscating layer
- storage The storage to obfuscate.
Shuffle an array in place.
- inputArray The array to shuffle.