1.4.0 • Published 9 years ago

validate-note v1.4.0

Weekly downloads
9
License
MIT
Repository
github
Last release
9 years ago

validate-note

Node NPM David Travis Coverage Status Gitmoji

šŸŽ¼ Validates a note (scientific pitch notation) and throws errors if needed

Usage

import validateNote from 'validate-note';

const note = validateNote('A#4');
console.log(note); // > { letter: 'A', signature: '#', octave: 4 }

Installation

Install via yarn

yarn add validate-note (--dev)

or npm

npm install validate-note (--save-dev)

configuration

You can pass in extra options (āž• required, āž– optional, āœļø default)

import validateNote from 'validate-note';

const note = validateNote('Bb4', {
  flatToSharp: true,
  maxOctave: 5,
  octave: true
});

console.log(note); // > { letter: 'A', signature: '#', octave: 4 }

āž– maxOctave ( Number ) āœļø 8 šŸ“ max octave allowed

āž– flatToSharp ( Boolean ) āœļø false šŸ“ convert flats (b) to sharps (#)

āž– octave ( Boolean ) āœļø false šŸ“ octave is required ā„¹ļø A# throws error, A#3 is a valid note

Builds

If you don't use a package manager, you can access validate-note via unpkg (CDN), download the source, or point your package manager to the url.

validate-note is compiled as a collection of CommonJS modules & ES2015 modules for bundlers that support the jsnext:main or module field in package.json (Rollup, Webpack 2)

The validate-note package includes precompiled production and development UMD builds in the dist folder. They can be used directly without a bundler and are thus compatible with many popular JavaScript module loaders and environments. You can drop a UMD build as a <script> tag on your page. The UMD builds make validate-note available as a window.validateNote global variable.

License

The code is available under the MIT license.

Contributing

We are open to contributions, see CONTRIBUTING.md for more info.

Misc

This module was created using generator-module-boilerplate.

1.4.0

9 years ago

1.3.2

9 years ago

1.3.1

9 years ago

1.2.9

10 years ago

1.2.8

10 years ago

1.2.6

10 years ago

1.2.4

10 years ago

1.2.3

10 years ago

1.2.1

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago