diff --git a/packages/core/test/pattern.test.mjs b/packages/core/test/pattern.test.mjs
index 1df5c8776..625f40756 100644
--- a/packages/core/test/pattern.test.mjs
+++ b/packages/core/test/pattern.test.mjs
@@ -796,7 +796,7 @@ describe('Pattern', () => {
});
});
describe('apply', () => {
- it('Can apply a function', () => {
+ (it('Can apply a function', () => {
expect(sequence('a', 'b').apply(fast(2)).firstCycle()).toStrictEqual(sequence('a', 'b').fast(2).firstCycle());
}),
it('Can apply a pattern of functions', () => {
@@ -804,7 +804,7 @@ describe('Pattern', () => {
expect(sequence('a', 'b').apply(fast(2), fast(3)).firstCycle()).toStrictEqual(
sequence('a', 'b').fast(2, 3).firstCycle(),
);
- });
+ }));
});
describe('layer', () => {
it('Can layer up multiple functions', () => {
diff --git a/packages/tonal/tonal.mjs b/packages/tonal/tonal.mjs
index ae75ab690..a24dc7f25 100644
--- a/packages/tonal/tonal.mjs
+++ b/packages/tonal/tonal.mjs
@@ -266,9 +266,14 @@ export const scale = register(
pat
.fmap((value) => {
const isObject = typeof value === 'object';
- // The case where the note has been defined via `n` or `pure`
- if (!isObject || (isObject && ('n' in value || 'value' in value))) {
- const step = isObject ? (value.n ?? value.value) : value;
+ // If value is a pure value, place it on `n` so that we interpret it as a scale
+ // degree
+ value = typeof value !== 'object' ? { n: value } : value;
+ if ('note' in value) {
+ const note = _getNearestScaleNote(scale, value.note);
+ return pure({ ...value, note });
+ } else if ('n' in value || 'value' in value) {
+ const step = value.n ?? value.value;
delete value.n; // remove n so it won't cause trouble
if (isNote(step)) {
// legacy..
@@ -277,7 +282,7 @@ export const scale = register(
try {
const [number, offset] = _convertStepToNumberAndOffset(step);
let note;
- if (isObject && value.anchor) {
+ if (value.anchor) {
note = stepInNamedScale(number, scale, value.anchor);
} else {
note = scaleStep(number, scale);
@@ -290,11 +295,9 @@ export const scale = register(
}
return value;
}
- // The case where the note has been defined via `note`
- else {
- const note = _getNearestScaleNote(scale, value.note);
- return pure(isObject ? { ...value, note } : note);
- }
+ throw new Error(
+ `Invalid value format for 'scale'. Value must contain 'n' or 'note' but received ${Object.keys(value)}`,
+ );
})
.outerJoin()
// legacy:
diff --git a/website/src/components/Header/Search.css b/website/src/components/Header/Search.css
index 456ef9f6b..b14146cbd 100644
--- a/website/src/components/Header/Search.css
+++ b/website/src/components/Header/Search.css
@@ -18,8 +18,8 @@
--docsearch-modal-background: var(--background);
--docsearch-muted-color: color-mix(in srgb, var(--foreground), #fff 30%);
--docsearch-key-gradient: var(--foreground);
- --docsearch-key-shadow: inset 0 -2px 0 0 var(--gutterForeground), inset 0 0 1px 1px var(--foreground),
- 0 1px 2px 1px var(--gutterBackground);
+ --docsearch-key-shadow:
+ inset 0 -2px 0 0 var(--gutterForeground), inset 0 0 1px 1px var(--foreground), 0 1px 2px 1px var(--gutterBackground);
}
.dark {
--docsearch-muted-color: color-mix(in srgb, var(--foreground), #000 30%);
diff --git a/website/src/pages/learn/samples.mdx b/website/src/pages/learn/samples.mdx
index eb79cccf7..201d57dfa 100644
--- a/website/src/pages/learn/samples.mdx
+++ b/website/src/pages/learn/samples.mdx
@@ -381,7 +381,7 @@ Sampler effects are functions that can be used to change the behaviour of sample
### scrub
-{' '}
+
### speed