@tonaljs/core 5.1.0 → 5.1.1

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.js CHANGED
@@ -7,7 +7,7 @@ let _tonaljs_pitch = require("@tonaljs/pitch");
7
7
  * @example
8
8
  * fillStr("#", 3) // => "###"
9
9
  */
10
- const fillStr = (s, n) => Array(Math.abs(n) + 1).join(s);
10
+ const fillStr = (s, n) => typeof s === "string" && Number.isInteger(n) ? Array(Math.abs(n) + 1).join(s) : "";
11
11
  /**
12
12
  * Wrap a function so it logs a deprecation warning (naming the alternative)
13
13
  * each time it is called, and then behaves as the original.
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\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"}
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) =>\n typeof s === \"string\" && Number.isInteger(n)\n ? Array(Math.abs(n) + 1).join(s)\n : \"\";\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,MACjC,OAAO,MAAM,YAAY,OAAO,UAAU,CAAC,IACvC,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAC7B;;;;;AAMN,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
@@ -10,7 +10,7 @@ export * from "@tonaljs/pitch-note";
10
10
  * @example
11
11
  * fillStr("#", 3) // => "###"
12
12
  */
13
- const fillStr = (s, n) => Array(Math.abs(n) + 1).join(s);
13
+ const fillStr = (s, n) => typeof s === "string" && Number.isInteger(n) ? Array(Math.abs(n) + 1).join(s) : "";
14
14
  /**
15
15
  * Wrap a function so it logs a deprecation warning (naming the alternative)
16
16
  * each time it is called, and then behaves as the original.
@@ -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\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"}
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) =>\n typeof s === \"string\" && Number.isInteger(n)\n ? Array(Math.abs(n) + 1).join(s)\n : \"\";\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,MACjC,OAAO,MAAM,YAAY,OAAO,UAAU,CAAC,IACvC,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,IAC7B;;;;;AAMN,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.1.0",
3
+ "version": "5.1.1",
4
4
  "description": "Music theory library",
5
5
  "keywords": [
6
6
  "music",
@@ -18,10 +18,10 @@
18
18
  "access": "public"
19
19
  },
20
20
  "dependencies": {
21
- "@tonaljs/pitch": "5.0.3",
22
- "@tonaljs/pitch-interval": "6.4.0",
23
- "@tonaljs/pitch-distance": "5.1.2",
24
- "@tonaljs/pitch-note": "6.2.0"
21
+ "@tonaljs/pitch": "5.0.4",
22
+ "@tonaljs/pitch-interval": "6.4.1",
23
+ "@tonaljs/pitch-distance": "5.1.3",
24
+ "@tonaljs/pitch-note": "6.2.1"
25
25
  },
26
26
  "scripts": {
27
27
  "build": "tsdown"