New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@tonaljs/chord

Package Overview
Dependencies
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tonaljs/chord - npm Package Compare versions

Comparing version

to
5.0.3

5

dist/index.d.ts
import { detect } from '@tonaljs/chord-detect';
export { detect } from '@tonaljs/chord-detect';
import { ChordType } from '@tonaljs/chord-type';
import { NoteName } from '@tonaljs/core';
import { NoteName } from '@tonaljs/pitch-note';
declare function deprecate<ResultFn extends (this: any, ...newArgs: any[]) => ReturnType<ResultFn>>(original: string, alternative: string, fn: ResultFn): (this: unknown, ...args: unknown[]) => ReturnType<ResultFn>;
type ChordName = string;

@@ -107,2 +108,2 @@ type ChordNameTokens = [string, string];

export { type Chord, chord, chordScales, _default as default, degrees, extended, get, getChord, reduced, steps, tokenize, transpose };
export { type Chord, chord, chordScales, _default as default, degrees, deprecate, extended, get, getChord, reduced, steps, tokenize, transpose };

30

dist/index.js

@@ -27,2 +27,3 @@ "use strict";

degrees: () => degrees,
deprecate: () => deprecate,
detect: () => import_chord_detect2.detect,

@@ -40,7 +41,13 @@ extended: () => extended,

var import_chord_type = require("@tonaljs/chord-type");
var import_core = require("@tonaljs/core");
var import_core2 = require("@tonaljs/core");
var import_pcset = require("@tonaljs/pcset");
var import_pitch_distance = require("@tonaljs/pitch-distance");
var import_pitch_note = require("@tonaljs/pitch-note");
var import_scale_type = require("@tonaljs/scale-type");
var import_chord_detect2 = require("@tonaljs/chord-detect");
function deprecate(original, alternative, fn) {
return function(...args) {
console.warn(`${original} is deprecated. Use ${alternative}.`);
return fn.apply(this, args);
};
}
var NoChord = {

@@ -63,3 +70,3 @@ empty: true,

function tokenize(name) {
const [letter, acc, oct, type] = (0, import_core2.tokenizeNote)(name);
const [letter, acc, oct, type] = (0, import_pitch_note.tokenizeNote)(name);
if (letter === "") {

@@ -87,8 +94,8 @@ return ["", name];

const type = (0, import_chord_type.get)(typeName);
const tonic = (0, import_core2.note)(optionalTonic || "");
const root = (0, import_core2.note)(optionalRoot || "");
const tonic = (0, import_pitch_note.note)(optionalTonic || "");
const root = (0, import_pitch_note.note)(optionalRoot || "");
if (type.empty || optionalTonic && tonic.empty || optionalRoot && root.empty) {
return NoChord;
}
const rootInterval = (0, import_core2.distance)(tonic.pc, root.pc);
const rootInterval = (0, import_pitch_distance.distance)(tonic.pc, root.pc);
const rootDegree = type.intervals.indexOf(rootInterval) + 1;

@@ -106,3 +113,3 @@ if (!root.empty && !rootDegree) {

}
const notes = tonic.empty ? [] : intervals.map((i) => (0, import_core2.transpose)(tonic, i));
const notes = tonic.empty ? [] : intervals.map((i) => (0, import_pitch_distance.transpose)(tonic, i));
typeName = type.aliases.indexOf(typeName) !== -1 ? typeName : type.aliases[0];

@@ -123,3 +130,3 @@ const symbol = `${tonic.empty ? "" : tonic.pc}${typeName}${root.empty || rootDegree <= 1 ? "" : "/" + root.pc}`;

}
var chord = (0, import_core2.deprecate)("Chord.chord", "Chord.get", get);
var chord = deprecate("Chord.chord", "Chord.get", get);
function transpose(chordName, interval) {

@@ -130,3 +137,3 @@ const [tonic, type] = tokenize(chordName);

}
return (0, import_core2.transpose)(tonic, interval) + type;
return (0, import_pitch_distance.transpose)(tonic, interval) + type;
}

@@ -150,3 +157,3 @@ function chordScales(name) {

const { intervals, tonic } = get(chordName);
const transpose2 = (0, import_core.tonicIntervalsTransposer)(intervals, tonic);
const transpose2 = (0, import_pitch_distance.tonicIntervalsTransposer)(intervals, tonic);
return (degree) => degree ? transpose2(degree > 0 ? degree - 1 : degree) : "";

@@ -156,3 +163,3 @@ }

const { intervals, tonic } = get(chordName);
return (0, import_core.tonicIntervalsTransposer)(intervals, tonic);
return (0, import_pitch_distance.tonicIntervalsTransposer)(intervals, tonic);
}

@@ -178,2 +185,3 @@ var chord_default = {

degrees,
deprecate,
detect,

@@ -180,0 +188,0 @@ extended,

{
"name": "@tonaljs/chord",
"version": "5.0.1",
"version": "5.0.3",
"description": "Musical chords and its relations",

@@ -19,8 +19,9 @@ "keywords": [

"dependencies": {
"@tonaljs/chord-detect": "^4.8.3",
"@tonaljs/chord-type": "^5.0.3",
"@tonaljs/collection": "^4.8.1",
"@tonaljs/core": "^4.10.3",
"@tonaljs/pcset": "^4.8.3",
"@tonaljs/scale-type": "^4.8.3"
"@tonaljs/chord-detect": "4.8.4",
"@tonaljs/chord-type": "5.0.4",
"@tonaljs/collection": "4.8.1",
"@tonaljs/pitch-note": "5.0.3",
"@tonaljs/pitch-distance": "5.0.2",
"@tonaljs/pcset": "4.9.1",
"@tonaljs/scale-type": "4.8.4"
},

@@ -32,5 +33,10 @@ "author": "danigb@gmail.com",

},
"jest": {
"preset": "ts-jest",
"testEnvironment": "node"
},
"scripts": {
"build": "tsup index.ts --sourcemap --dts --format esm,cjs"
"build": "tsup index.ts --sourcemap --dts --format esm,cjs",
"test": "jest --coverage"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet