sethares-dissonance 2.1.0 → 2.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/README.md +12 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -79,26 +79,22 @@ import {
|
|
|
79
79
|
import type { ReadOnlyDissonanceCurve } from "sethares-dissonance";
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
|
-
* Read-only view of DissonanceCurve without the
|
|
82
|
+
* Read-only view of DissonanceCurve without the methods that cause mutation.
|
|
83
83
|
* Use this type when exposing the curve from hooks to prevent external mutation.
|
|
84
84
|
*/
|
|
85
|
-
|
|
85
|
+
type ReadOnlyDissonanceCurve = Omit<
|
|
86
86
|
DissonanceCurve,
|
|
87
87
|
"recalculate"
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
function createReadOnlyWrapper(
|
|
91
|
-
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
plotCents: () => curve.plotCents(),
|
|
99
|
-
findNearestPoint: (ratio) => curve.findNearestPoint(ratio),
|
|
100
|
-
// .. can add more methods if needed, aboid those that cause mutations
|
|
101
|
-
};
|
|
88
|
+
>;
|
|
89
|
+
|
|
90
|
+
function createReadOnlyWrapper(curve: DissonanceCurve) {
|
|
91
|
+
return {
|
|
92
|
+
get maxDissonance() {
|
|
93
|
+
return curve.maxDissonance
|
|
94
|
+
},
|
|
95
|
+
plotCents: () => curve.plotCents()
|
|
96
|
+
// ... can map more methods if needed
|
|
97
|
+
} satisfies Partial<ReadOnlyDissonanceCurve>
|
|
102
98
|
}
|
|
103
99
|
|
|
104
100
|
export function useDissonanceCurve(
|