How to use the tonal-pitches.isStr function in tonal-pitches

To help you get started, we’ve selected a few tonal-pitches examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tonaljs / tonal / packages / tonal-keys / lib / index.js View on Github external
export const fromName = (str) => {
  if (!isStr(str)) return null
  var p = str.split(/\s+/)
  switch (p.length) {
    case 1: return isNoteStr(p[0]) ? build(p[0], 'major')
      : isModeStr(p[0]) ? build(false, p[0]) : null
    case 2: return build(p[0], p[1])
    default: return null
  }
}
github tonaljs / tonal / packages / tonal-keys / dist / index.js View on Github external
var fromName = function fromName(str) {
  if (!tonalPitches.isStr(str)) return null;
  var p = str.split(/\s+/);
  switch (p.length) {
    case 1:
      return tonalPitches.isNoteStr(p[0]) ? build(p[0], 'major') : isModeStr(p[0]) ? build(false, p[0]) : null;
    case 2:
      return build(p[0], p[1]);
    default:
      return null;
  }
};
github tonaljs / tonal / packages / tonal-keys / dist / index.js View on Github external
function build(tonic, mode) {
  if (!tonalPitches.isStr(mode)) return null;
  var m = mode.trim().toLowerCase();
  if (!isModeStr(m)) return null;
  var t = tonalNotes.pc(tonic) || false;
  var n = t ? t + ' ' + m : null;
  return { name: n, tonic: t, mode: m };
}
github tonaljs / tonal / packages / tonal-keys / lib / index.js View on Github external
export function build (tonic, mode) {
  if (!isStr(mode)) return null
  var m = mode.trim().toLowerCase()
  if (!isModeStr(m)) return null
  var t = pc(tonic) || false
  var n = t ? t + ' ' + m : null
  return { name: n, tonic: t, mode: m }
}