@tonaljs/core 5.0.5 → 5.1.0

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/dist/index.d.mts CHANGED
@@ -2,10 +2,19 @@ export * from "@tonaljs/pitch";
2
2
  export * from "@tonaljs/pitch-distance";
3
3
  export * from "@tonaljs/pitch-interval";
4
4
  export * from "@tonaljs/pitch-note";
5
- //#region index.d.ts
5
+ /**
6
+ * Repeat a string the absolute value of `n` times.
7
+ *
8
+ * @example
9
+ * fillStr("#", 3) // => "###"
10
+ */
6
11
  declare const fillStr: (s: string, n: number) => string;
12
+ /**
13
+ * Wrap a function so it logs a deprecation warning (naming the alternative)
14
+ * each time it is called, and then behaves as the original.
15
+ */
7
16
  declare function deprecate<ResultFn extends (this: any, ...newArgs: any[]) => ReturnType<ResultFn>>(original: string, alternative: string, fn: ResultFn): (this: unknown, ...args: unknown[]) => ReturnType<ResultFn>;
17
+ /** @deprecated Use isNamedPitch instead. */
8
18
  declare const isNamed: (this: unknown, ...args: unknown[]) => boolean;
9
- //#endregion
10
19
  export { deprecate, fillStr, isNamed };
11
20
  //# sourceMappingURL=index.d.mts.map
package/dist/index.d.ts CHANGED
@@ -2,10 +2,19 @@ export * from "@tonaljs/pitch";
2
2
  export * from "@tonaljs/pitch-distance";
3
3
  export * from "@tonaljs/pitch-interval";
4
4
  export * from "@tonaljs/pitch-note";
5
- //#region index.d.ts
5
+ /**
6
+ * Repeat a string the absolute value of `n` times.
7
+ *
8
+ * @example
9
+ * fillStr("#", 3) // => "###"
10
+ */
6
11
  declare const fillStr: (s: string, n: number) => string;
12
+ /**
13
+ * Wrap a function so it logs a deprecation warning (naming the alternative)
14
+ * each time it is called, and then behaves as the original.
15
+ */
7
16
  declare function deprecate<ResultFn extends (this: any, ...newArgs: any[]) => ReturnType<ResultFn>>(original: string, alternative: string, fn: ResultFn): (this: unknown, ...args: unknown[]) => ReturnType<ResultFn>;
17
+ /** @deprecated Use isNamedPitch instead. */
8
18
  declare const isNamed: (this: unknown, ...args: unknown[]) => boolean;
9
- //#endregion
10
19
  export { deprecate, fillStr, isNamed };
11
20
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,15 +1,25 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let _tonaljs_pitch = require("@tonaljs/pitch");
3
- //#region index.ts
3
+ // index.ts
4
+ /**
5
+ * Repeat a string the absolute value of `n` times.
6
+ *
7
+ * @example
8
+ * fillStr("#", 3) // => "###"
9
+ */
4
10
  const fillStr = (s, n) => Array(Math.abs(n) + 1).join(s);
11
+ /**
12
+ * Wrap a function so it logs a deprecation warning (naming the alternative)
13
+ * each time it is called, and then behaves as the original.
14
+ */
5
15
  function deprecate(original, alternative, fn) {
6
16
  return function(...args) {
7
17
  console.warn(`${original} is deprecated. Use ${alternative}.`);
8
18
  return fn.apply(this, args);
9
19
  };
10
20
  }
21
+ /** @deprecated Use isNamedPitch instead. */
11
22
  const isNamed = deprecate("isNamed", "isNamedPitch", _tonaljs_pitch.isNamedPitch);
12
- //#endregion
13
23
  exports.deprecate = deprecate;
14
24
  exports.fillStr = fillStr;
15
25
  exports.isNamed = isNamed;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","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
+ {"version":3,"file":"index.js","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\n/**\n * Repeat a string the absolute value of `n` times.\n *\n * @example\n * fillStr(\"#\", 3) // => \"###\"\n */\nexport const fillStr = (s: string, n: number) => Array(Math.abs(n) + 1).join(s);\n\n/**\n * Wrap a function so it logs a deprecation warning (naming the alternative)\n * each time it is called, and then behaves as the original.\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\n/** @deprecated Use isNamedPitch instead. */\nexport const isNamed = deprecate(\"isNamed\", \"isNamedPitch\", isNamedPitch);\n"],"mappings":";;;;;;;;;AAaA,MAAa,WAAW,GAAW,MAAc,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;;;;;AAM9E,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;;AAGA,MAAa,UAAU,UAAU,WAAW,gBAAgBA,eAAAA,YAAY"}
package/dist/index.mjs CHANGED
@@ -3,16 +3,26 @@ export * from "@tonaljs/pitch";
3
3
  export * from "@tonaljs/pitch-distance";
4
4
  export * from "@tonaljs/pitch-interval";
5
5
  export * from "@tonaljs/pitch-note";
6
- //#region index.ts
6
+ // index.ts
7
+ /**
8
+ * Repeat a string the absolute value of `n` times.
9
+ *
10
+ * @example
11
+ * fillStr("#", 3) // => "###"
12
+ */
7
13
  const fillStr = (s, n) => Array(Math.abs(n) + 1).join(s);
14
+ /**
15
+ * Wrap a function so it logs a deprecation warning (naming the alternative)
16
+ * each time it is called, and then behaves as the original.
17
+ */
8
18
  function deprecate(original, alternative, fn) {
9
19
  return function(...args) {
10
20
  console.warn(`${original} is deprecated. Use ${alternative}.`);
11
21
  return fn.apply(this, args);
12
22
  };
13
23
  }
24
+ /** @deprecated Use isNamedPitch instead. */
14
25
  const isNamed = deprecate("isNamed", "isNamedPitch", isNamedPitch);
15
- //#endregion
16
26
  export { deprecate, fillStr, isNamed };
17
27
 
18
28
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
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"}
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\n/**\n * Repeat a string the absolute value of `n` times.\n *\n * @example\n * fillStr(\"#\", 3) // => \"###\"\n */\nexport const fillStr = (s: string, n: number) => Array(Math.abs(n) + 1).join(s);\n\n/**\n * Wrap a function so it logs a deprecation warning (naming the alternative)\n * each time it is called, and then behaves as the original.\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\n/** @deprecated Use isNamedPitch instead. */\nexport const isNamed = deprecate(\"isNamed\", \"isNamedPitch\", isNamedPitch);\n"],"mappings":";;;;;;;;;;;;AAaA,MAAa,WAAW,GAAW,MAAc,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;;;;;AAM9E,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;;AAGA,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.5",
3
+ "version": "5.1.0",
4
4
  "description": "Music theory library",
5
5
  "keywords": [
6
6
  "music",
@@ -19,9 +19,9 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@tonaljs/pitch": "5.0.3",
22
- "@tonaljs/pitch-interval": "6.2.0",
23
- "@tonaljs/pitch-distance": "5.1.0",
24
- "@tonaljs/pitch-note": "6.1.2"
22
+ "@tonaljs/pitch-interval": "6.4.0",
23
+ "@tonaljs/pitch-distance": "5.1.2",
24
+ "@tonaljs/pitch-note": "6.2.0"
25
25
  },
26
26
  "scripts": {
27
27
  "build": "tsdown"