@tonaljs/core 5.0.1 → 5.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -1
- package/dist/index.cjs +52 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{index.d.ts → index.d.cts} +7 -6
- package/dist/index.d.mts +7 -6
- package/dist/index.mjs +10 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
- package/dist/index.js +0 -52
- package/dist/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -38,8 +38,9 @@ Given a note name, it returns an object with the following properties:
|
|
|
38
38
|
- alt: the accidental number (..., -1 = 'b', 0 = '', 1 = '#', ...)
|
|
39
39
|
- oct: the octave (or null if not present)
|
|
40
40
|
- chroma: the note chroma (0..11)
|
|
41
|
+
- height: a number to compare and sort notes by pitch. Equals the midi number when the note has an octave (even outside the 0..127 midi range). Pitch classes get a large negative value, so they sort before any note with octave
|
|
41
42
|
- midi: the note midi or null if octave is not present
|
|
42
|
-
- freq: the note frequency in Hertzes, or null if the octave is
|
|
43
|
+
- freq: the note frequency in Hertzes, or null if the octave is not present
|
|
43
44
|
|
|
44
45
|
Example:
|
|
45
46
|
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _tonaljs_pitch = require("@tonaljs/pitch");
|
|
3
|
+
//#region index.ts
|
|
4
|
+
const fillStr = (s, n) => Array(Math.abs(n) + 1).join(s);
|
|
5
|
+
function deprecate(original, alternative, fn) {
|
|
6
|
+
return function(...args) {
|
|
7
|
+
console.warn(`${original} is deprecated. Use ${alternative}.`);
|
|
8
|
+
return fn.apply(this, args);
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const isNamed = deprecate("isNamed", "isNamedPitch", _tonaljs_pitch.isNamedPitch);
|
|
12
|
+
//#endregion
|
|
13
|
+
exports.deprecate = deprecate;
|
|
14
|
+
exports.fillStr = fillStr;
|
|
15
|
+
exports.isNamed = isNamed;
|
|
16
|
+
Object.keys(_tonaljs_pitch).forEach(function(k) {
|
|
17
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return _tonaljs_pitch[k];
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
var _tonaljs_pitch_distance = require("@tonaljs/pitch-distance");
|
|
25
|
+
Object.keys(_tonaljs_pitch_distance).forEach(function(k) {
|
|
26
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function() {
|
|
29
|
+
return _tonaljs_pitch_distance[k];
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
var _tonaljs_pitch_interval = require("@tonaljs/pitch-interval");
|
|
34
|
+
Object.keys(_tonaljs_pitch_interval).forEach(function(k) {
|
|
35
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
36
|
+
enumerable: true,
|
|
37
|
+
get: function() {
|
|
38
|
+
return _tonaljs_pitch_interval[k];
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
var _tonaljs_pitch_note = require("@tonaljs/pitch-note");
|
|
43
|
+
Object.keys(_tonaljs_pitch_note).forEach(function(k) {
|
|
44
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function() {
|
|
47
|
+
return _tonaljs_pitch_note[k];
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["isNamedPitch"],"sources":["../index.ts"],"sourcesContent":["import { isNamedPitch } from \"@tonaljs/pitch\";\n\nexport * from \"@tonaljs/pitch\";\nexport * from \"@tonaljs/pitch-distance\";\nexport * from \"@tonaljs/pitch-interval\";\nexport * from \"@tonaljs/pitch-note\";\n\nexport const fillStr = (s: string, n: number) => Array(Math.abs(n) + 1).join(s);\n\nexport function deprecate<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ResultFn extends (this: any, ...newArgs: any[]) => ReturnType<ResultFn>,\n>(original: string, alternative: string, fn: ResultFn) {\n return function (this: unknown, ...args: unknown[]): ReturnType<ResultFn> {\n // tslint:disable-next-line\n console.warn(`${original} is deprecated. Use ${alternative}.`);\n return fn.apply(this, args);\n };\n}\n\nexport const isNamed = deprecate(\"isNamed\", \"isNamedPitch\", isNamedPitch);\n"],"mappings":";;;AAOA,MAAa,WAAW,GAAW,MAAc,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAE9E,SAAgB,UAGd,UAAkB,aAAqB,IAAc;CACrD,OAAO,SAAyB,GAAG,MAAuC;EAExE,QAAQ,KAAK,GAAG,SAAS,sBAAsB,YAAY,EAAE;EAC7D,OAAO,GAAG,MAAM,MAAM,IAAI;CAC5B;AACF;AAEA,MAAa,UAAU,UAAU,WAAW,gBAAgBA,eAAAA,YAAY"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
|
|
1
|
+
export * from "@tonaljs/pitch";
|
|
2
|
+
export * from "@tonaljs/pitch-distance";
|
|
3
|
+
export * from "@tonaljs/pitch-interval";
|
|
4
|
+
export * from "@tonaljs/pitch-note";
|
|
5
|
+
//#region index.d.ts
|
|
6
6
|
declare const fillStr: (s: string, n: number) => string;
|
|
7
7
|
declare function deprecate<ResultFn extends (this: any, ...newArgs: any[]) => ReturnType<ResultFn>>(original: string, alternative: string, fn: ResultFn): (this: unknown, ...args: unknown[]) => ReturnType<ResultFn>;
|
|
8
8
|
declare const isNamed: (this: unknown, ...args: unknown[]) => boolean;
|
|
9
|
-
|
|
9
|
+
//#endregion
|
|
10
10
|
export { deprecate, fillStr, isNamed };
|
|
11
|
+
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
|
|
1
|
+
export * from "@tonaljs/pitch";
|
|
2
|
+
export * from "@tonaljs/pitch-distance";
|
|
3
|
+
export * from "@tonaljs/pitch-interval";
|
|
4
|
+
export * from "@tonaljs/pitch-note";
|
|
5
|
+
//#region index.d.ts
|
|
6
6
|
declare const fillStr: (s: string, n: number) => string;
|
|
7
7
|
declare function deprecate<ResultFn extends (this: any, ...newArgs: any[]) => ReturnType<ResultFn>>(original: string, alternative: string, fn: ResultFn): (this: unknown, ...args: unknown[]) => ReturnType<ResultFn>;
|
|
8
8
|
declare const isNamed: (this: unknown, ...args: unknown[]) => boolean;
|
|
9
|
-
|
|
9
|
+
//#endregion
|
|
10
10
|
export { deprecate, fillStr, isNamed };
|
|
11
|
+
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
// index.ts
|
|
2
1
|
import { isNamedPitch } from "@tonaljs/pitch";
|
|
3
2
|
export * from "@tonaljs/pitch";
|
|
4
3
|
export * from "@tonaljs/pitch-distance";
|
|
5
4
|
export * from "@tonaljs/pitch-interval";
|
|
6
5
|
export * from "@tonaljs/pitch-note";
|
|
7
|
-
|
|
6
|
+
//#region index.ts
|
|
7
|
+
const fillStr = (s, n) => Array(Math.abs(n) + 1).join(s);
|
|
8
8
|
function deprecate(original, alternative, fn) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
return function(...args) {
|
|
10
|
+
console.warn(`${original} is deprecated. Use ${alternative}.`);
|
|
11
|
+
return fn.apply(this, args);
|
|
12
|
+
};
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
isNamed
|
|
19
|
-
};
|
|
14
|
+
const isNamed = deprecate("isNamed", "isNamedPitch", isNamedPitch);
|
|
15
|
+
//#endregion
|
|
16
|
+
export { deprecate, fillStr, isNamed };
|
|
17
|
+
|
|
20
18
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../index.ts"],"sourcesContent":["import { isNamedPitch } from \"@tonaljs/pitch\";\n\nexport * from \"@tonaljs/pitch\";\nexport * from \"@tonaljs/pitch-distance\";\nexport * from \"@tonaljs/pitch-interval\";\nexport * from \"@tonaljs/pitch-note\";\n\nexport const fillStr = (s: string, n: number) => Array(Math.abs(n) + 1).join(s);\n\nexport function deprecate<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ResultFn extends (this: any, ...newArgs: any[]) => ReturnType<ResultFn>,\n>(original: string, alternative: string, fn: ResultFn) {\n return function (this: unknown, ...args: unknown[]): ReturnType<ResultFn> {\n // tslint:disable-next-line\n console.warn(`${original} is deprecated. Use ${alternative}.`);\n return fn.apply(this, args);\n };\n}\n\nexport const isNamed = deprecate(\"isNamed\", \"isNamedPitch\", isNamedPitch);\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../index.ts"],"sourcesContent":["import { isNamedPitch } from \"@tonaljs/pitch\";\n\nexport * from \"@tonaljs/pitch\";\nexport * from \"@tonaljs/pitch-distance\";\nexport * from \"@tonaljs/pitch-interval\";\nexport * from \"@tonaljs/pitch-note\";\n\nexport const fillStr = (s: string, n: number) => Array(Math.abs(n) + 1).join(s);\n\nexport function deprecate<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ResultFn extends (this: any, ...newArgs: any[]) => ReturnType<ResultFn>,\n>(original: string, alternative: string, fn: ResultFn) {\n return function (this: unknown, ...args: unknown[]): ReturnType<ResultFn> {\n // tslint:disable-next-line\n console.warn(`${original} is deprecated. Use ${alternative}.`);\n return fn.apply(this, args);\n };\n}\n\nexport const isNamed = deprecate(\"isNamed\", \"isNamedPitch\", isNamedPitch);\n"],"mappings":";;;;;;AAOA,MAAa,WAAW,GAAW,MAAc,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAE9E,SAAgB,UAGd,UAAkB,aAAqB,IAAc;CACrD,OAAO,SAAyB,GAAG,MAAuC;EAExE,QAAQ,KAAK,GAAG,SAAS,sBAAsB,YAAY,EAAE;EAC7D,OAAO,GAAG,MAAM,MAAM,IAAI;CAC5B;AACF;AAEA,MAAa,UAAU,UAAU,WAAW,gBAAgB,YAAY"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tonaljs/core",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.3",
|
|
4
4
|
"description": "Music theory library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"music",
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@tonaljs/pitch": "5.0.2",
|
|
22
|
-
"@tonaljs/pitch-interval": "6.
|
|
23
|
-
"@tonaljs/pitch-distance": "5.0.
|
|
24
|
-
"@tonaljs/pitch-note": "6.
|
|
22
|
+
"@tonaljs/pitch-interval": "6.1.1",
|
|
23
|
+
"@tonaljs/pitch-distance": "5.0.6",
|
|
24
|
+
"@tonaljs/pitch-note": "6.1.1"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
|
-
"build": "
|
|
27
|
+
"build": "tsdown index.ts --sourcemap --dts --format esm,cjs"
|
|
28
28
|
}
|
|
29
29
|
}
|
package/dist/index.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
|
|
21
|
-
// index.ts
|
|
22
|
-
var core_exports = {};
|
|
23
|
-
__export(core_exports, {
|
|
24
|
-
deprecate: () => deprecate,
|
|
25
|
-
fillStr: () => fillStr,
|
|
26
|
-
isNamed: () => isNamed
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(core_exports);
|
|
29
|
-
var import_pitch = require("@tonaljs/pitch");
|
|
30
|
-
__reExport(core_exports, require("@tonaljs/pitch"), module.exports);
|
|
31
|
-
__reExport(core_exports, require("@tonaljs/pitch-distance"), module.exports);
|
|
32
|
-
__reExport(core_exports, require("@tonaljs/pitch-interval"), module.exports);
|
|
33
|
-
__reExport(core_exports, require("@tonaljs/pitch-note"), module.exports);
|
|
34
|
-
var fillStr = (s, n) => Array(Math.abs(n) + 1).join(s);
|
|
35
|
-
function deprecate(original, alternative, fn) {
|
|
36
|
-
return function(...args) {
|
|
37
|
-
console.warn(`${original} is deprecated. Use ${alternative}.`);
|
|
38
|
-
return fn.apply(this, args);
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
var isNamed = deprecate("isNamed", "isNamedPitch", import_pitch.isNamedPitch);
|
|
42
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
-
0 && (module.exports = {
|
|
44
|
-
deprecate,
|
|
45
|
-
fillStr,
|
|
46
|
-
isNamed,
|
|
47
|
-
...require("@tonaljs/pitch"),
|
|
48
|
-
...require("@tonaljs/pitch-distance"),
|
|
49
|
-
...require("@tonaljs/pitch-interval"),
|
|
50
|
-
...require("@tonaljs/pitch-note")
|
|
51
|
-
});
|
|
52
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../index.ts"],"sourcesContent":["import { isNamedPitch } from \"@tonaljs/pitch\";\n\nexport * from \"@tonaljs/pitch\";\nexport * from \"@tonaljs/pitch-distance\";\nexport * from \"@tonaljs/pitch-interval\";\nexport * from \"@tonaljs/pitch-note\";\n\nexport const fillStr = (s: string, n: number) => Array(Math.abs(n) + 1).join(s);\n\nexport function deprecate<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ResultFn extends (this: any, ...newArgs: any[]) => ReturnType<ResultFn>,\n>(original: string, alternative: string, fn: ResultFn) {\n return function (this: unknown, ...args: unknown[]): ReturnType<ResultFn> {\n // tslint:disable-next-line\n console.warn(`${original} is deprecated. Use ${alternative}.`);\n return fn.apply(this, args);\n };\n}\n\nexport const isNamed = deprecate(\"isNamed\", \"isNamedPitch\", isNamedPitch);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA6B;AAE7B,yBAAc,2BAFd;AAGA,yBAAc,oCAHd;AAIA,yBAAc,oCAJd;AAKA,yBAAc,gCALd;AAOO,IAAM,UAAU,CAAC,GAAW,MAAc,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC;AAEvE,SAAS,UAGd,UAAkB,aAAqB,IAAc;AACrD,SAAO,YAA4B,MAAuC;AAExE,YAAQ,KAAK,GAAG,QAAQ,uBAAuB,WAAW,GAAG;AAC7D,WAAO,GAAG,MAAM,MAAM,IAAI;AAAA,EAC5B;AACF;AAEO,IAAM,UAAU,UAAU,WAAW,gBAAgB,yBAAY;","names":[]}
|