0.1.11 • Published 5 years ago

cyclon.p2p-common v0.1.11

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

cyclon.p2p-common

Build Status Dependencies

Some utilities used by various cyclon.p2p modules

Usage

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');

The API

randomSample(inputArray, sampleSize)

Select a random sample of items from an array using reservoir sampling.

Parameters

  • inputArray The array to sample from.
  • sampleSize The number of items to sample.

checkArguments(argumentsArray, expectedCount)

Check that an arguments array contains the expected number of items, throw an Error otherwise.

Parameters

  • argumentsArray The arguments array to check.
  • expectedCount The expected size of the arguments array.

consoleLogger()

Get the singleton ConsoleLogger instance.

newInMemoryStorage()

Create instances of an in-memory implementation of the DOM storage API.

asyncExecService()

Get the singleton instance of the AsyncExecService interface that's used in a lot of places.

obfuscateStorage(storage)

Decorate implementations of the DOM storage API with an obfuscating layer

Parameters

  • storage The storage to obfuscate.

shuffleArray(inputArray)

Shuffle an array in place.

Parameters

  • inputArray The array to shuffle.
0.1.11

5 years ago

0.1.10

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago