all files / music-notation/pitch/ pitch.js

100% Statements 4/4
100% Branches 0/0
100% Functions 1/1
100% Lines 3/3
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22                                     
'use strict'
 
var str = require('./str')
var parse = require('./parse')
 
/**
 * Get a pitch from a string. In tonal a pitch it's a note, an interval or a
 * pitch class. It allows us to work with this elements in an uniform way.
 *
 * @name pitch
 * @function
 * @param {String} source - the string
 * @return {String} the pitch or null if not a valid pitch
 *
 * @example
 * var pitch = require('music-notation/pitch/pitch')
 * pitch('c2') // => 'C2'
 * pitch('2') // => '2M'
 * pitch('blah') // => null
 */
module.exports = function (s) { return str(parse(s)) }