@royalschedule/input-analyzer
TypeScript icon, indicating that this package has built-in type declarations

3.0.5 • Public • Published

Input analyzer

A script that analyzes the json input to be processed by the scheduling algorithm.

Installation

npm i -S @royalschedule/input-analyzer

Usage

import { Analyzer } from '@royalschedule/input-analyzer';

// Analyze the json input
let analyzer = new Analyzer({ ... });

// The analyzer first verifies the input using the input-verifier npm
// package (@royalschedule/input-verifier) since it may encounter
// critical errors making the analysis impossible
if (analyzer.errors.length) {
  throw `The analyzer ran into ${analyzer.errors.length} error(s).`;
}

// The analyzer has information about areas, dependencies, etc.
console.log(`No. areas:        ${analyzer.areas.size}       `);
console.log(`No. dependencies: ${analyzer.dependencies.size}`);
console.log(`No. groups:       ${analyzer.groups.size}      `);
console.log(`No. collections:  ${analyzer.collections.size} `);
console.log(`No. events:       ${analyzer.events.length}    `);

// We can for example check how many events are guaranteed to overlap
// (this method merely returns a lower bound)
const overlaps = analyzer.computeOverlaps();
console.log(`${overlaps.length} event(s) are guaranteed to overlap.`);

Readme

Keywords

none

Package Sidebar

Install

npm i @royalschedule/input-analyzer

Weekly Downloads

13

Version

3.0.5

License

ISC

Unpacked Size

1.06 MB

Total Files

135

Last publish

Collaborators

  • blomquist
  • andersson-royalschedule