npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

uss-validator

v1.0.3

Published

Provides validation for Universal Schedule Standard (.uss) objects

Downloads

12

Readme

Universal Schedule Standard Validator

GitHub issues GitHub closed issues GitHub pull requests GitHub closed pull requests License: MIT

Provides validation for Universal Schedule Standard objects.

This package may be used either on the frontend or backend. Is is written in ECMA Script 5, so it is widely compatible with any Javascript project.

Install

Navigate to your project folder and enter the following in terminal:

npm install uss-validator

The uss-validator will be added into your project and your package.json file.

How to Use

You call the validator with a Universal Schedule Standard Object as the only argument. The validator accepts Universal Schedule Standard objects as either JSON strings or JSON objects.

import validator from 'uss-validator'

// then get get a .uss file or an object

const universalScheduleStandardObject = JSON.parse(file)
const response = validator(universalScheduleStandardObject)

console.log(response)

It will return a response object.

Response Object

The response object has four primary key values: isValid, errors, warnings and info.

{  
  isValid: true,
  errors: [],
  warnings: [
    { 
      title: 'Stripboard missing Calendar', 
      location: ['5d01230c987033001725c908'],
      message: 'There is a stripboard that is missing its calendarId'
    }
  ],
  info: { 
    isSchedule: true,
    name: 'Small Sample Schedule',
    source: 'Think Crew',
    ussVersion: '1.0.0',
    breakdowns: 3,
    categories: 5,
    elements: 6,
    stripboards: 2,
    calendars: 1
  }
}

The isValid value is a boolean that denotes whether the USS object is considered to be a valid construction.

The errors and warnings values are arrays that may contain error objects that describe any issues with the USS object. Errors are considered fatal and always result in isValid returning false. Warnings are merely related to the user's data potentially being malformed, and are not fatal.

The info object contains various pieces of information about the USS object:

| Key | Value | | :--- | :--- | | isSchedule | boolean | true if the USS object contains both stripboard and calendar data | | name | string | the name of the schedule | | source | string | the originating site or app | | ussVersion | string | the version of the standard this file is using | | breakdowns | number | the number of breakdowns in the object | | categories | number | the number of categories in the object | | elements | number | the number of elements in the object | | stripboards| number | the number of stripboards in the object | | calendars | number | the number of calendars in the object |

Error Objects

The uss-validator will return errors or warnings in the following format:

{
  title: string | the title of the error or warning,
  message: string | the full error or warning message,
  location: array | an array of text strings that will give clues as to where the error occurred in the file
}

Errors and warnings use the same object construction.