Skip to content

Commit 54e26f6

Browse files
switch to kebab case
1 parent 327b072 commit 54e26f6

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

spec.emu

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ copyright: false
4949
1. If _windowSize_ is not an integral Number in the inclusive interval from *1*<sub>𝔽</sub> to 𝔽(2<sup>32</sup> - 1), then
5050
1. Let _error_ be ThrowCompletion(a newly created *RangeError* object).
5151
1. Return ? IteratorClose(_iterated_, _error_).
52-
1. If _undersized_ is *undefined*, set _undersized_ to *"only full"*.
53-
1. If _undersized_ is neither *"only full"* nor *"allow partial"*, then
52+
1. If _undersized_ is *undefined*, set _undersized_ to *"only-full"*.
53+
1. If _undersized_ is neither *"only-full"* nor *"allow-partial"*, then
5454
1. Let _error_ be ThrowCompletion(a newly created *TypeError* object).
5555
1. Return ? IteratorClose(_iterated_, _error_).
5656
1. Set _iterated_ to ? GetIteratorDirect(_O_).
@@ -59,7 +59,7 @@ copyright: false
5959
1. Repeat,
6060
1. Let _value_ be ? IteratorStepValue(_iterated_).
6161
1. If _value_ is ~done~, then
62-
1. If _undersized_ is *"allow partial"*, _buffer_ is not empty, and the number of elements in _buffer_ &lt; ℝ(_windowSize_), then
62+
1. If _undersized_ is *"allow-partial"*, _buffer_ is not empty, and the number of elements in _buffer_ &lt; ℝ(_windowSize_), then
6363
1. Perform Completion(Yield(CreateArrayFromList(_buffer_))).
6464
1. Return ReturnCompletion(*undefined*).
6565
1. If the number of elements in _buffer_ is ℝ(_windowSize_), then

src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function chunks(this: unknown, chunkSize: unknown): Generator<unknown> {
3131
return chunksImpl(this as Iterator<unknown>, chunkSize)
3232
}
3333

34-
function* windowsImpl<A>(iter: Iterator<A>, windowSize: number, undersized: 'only full' | 'allow partial'): Generator<Array<A>> {
34+
function* windowsImpl<A>(iter: Iterator<A>, windowSize: number, undersized: 'only-full' | 'allow-partial'): Generator<Array<A>> {
3535
let buffer = [];
3636
for (const elem of liftIterator(iter)) {
3737
if (buffer.length === windowSize) {
@@ -42,12 +42,12 @@ function* windowsImpl<A>(iter: Iterator<A>, windowSize: number, undersized: 'onl
4242
yield buffer.slice();
4343
}
4444
}
45-
if (undersized === 'allow partial' && 0 < buffer.length && buffer.length < windowSize) {
45+
if (undersized === 'allow-partial' && 0 < buffer.length && buffer.length < windowSize) {
4646
yield buffer;
4747
}
4848
}
4949

50-
function windows<A>(this: Iterator<A>, windowSize: number, undersized?: 'only full' | 'allow partial'): Generator<Array<A>>
50+
function windows<A>(this: Iterator<A>, windowSize: number, undersized?: 'only-full' | 'allow-partial'): Generator<Array<A>>
5151
function windows(this: unknown, windowSize: unknown, undersized?: unknown): Generator<unknown> {
5252
if (
5353
typeof windowSize !== 'number'
@@ -58,9 +58,9 @@ function windows(this: unknown, windowSize: unknown, undersized?: unknown): Gene
5858
throw new RangeError;
5959
}
6060
if (undersized === undefined) {
61-
undersized = 'only full';
61+
undersized = 'only-full';
6262
}
63-
if (undersized !== 'only full' && undersized !== 'allow partial') {
63+
if (undersized !== 'only-full' && undersized !== 'allow-partial') {
6464
throw new TypeError;
6565
}
6666
return windowsImpl(this as Iterator<unknown>, windowSize, undersized);

test/index.mjs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ test('windows', async t => {
6666
[[0, 1], [1, 2], [2, 3], [3, 4]],
6767
);
6868
assert.deepEqual(
69-
Array.from(nats(5).windows(2, "only full")),
69+
Array.from(nats(5).windows(2, "only-full")),
7070
[[0, 1], [1, 2], [2, 3], [3, 4]],
7171
);
7272
assert.deepEqual(
73-
Array.from(nats(5).windows(2, "allow partial")),
73+
Array.from(nats(5).windows(2, "allow-partial")),
7474
[[0, 1], [1, 2], [2, 3], [3, 4]],
7575
);
7676

@@ -83,11 +83,11 @@ test('windows', async t => {
8383
[[0], [1], [2], [3], [4]],
8484
);
8585
assert.deepEqual(
86-
Array.from(nats(5).windows(1, "only full")),
86+
Array.from(nats(5).windows(1, "only-full")),
8787
[[0], [1], [2], [3], [4]],
8888
);
8989
assert.deepEqual(
90-
Array.from(nats(5).windows(1, "allow partial")),
90+
Array.from(nats(5).windows(1, "allow-partial")),
9191
[[0], [1], [2], [3], [4]],
9292
);
9393

@@ -100,11 +100,11 @@ test('windows', async t => {
100100
[[0, 1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5]],
101101
);
102102
assert.deepEqual(
103-
Array.from(nats(6).windows(3, "only full")),
103+
Array.from(nats(6).windows(3, "only-full")),
104104
[[0, 1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5]],
105105
);
106106
assert.deepEqual(
107-
Array.from(nats(6).windows(3, "allow partial")),
107+
Array.from(nats(6).windows(3, "allow-partial")),
108108
[[0, 1, 2], [1, 2, 3], [2, 3, 4], [3, 4, 5]],
109109
);
110110

@@ -117,11 +117,11 @@ test('windows', async t => {
117117
[],
118118
);
119119
assert.deepEqual(
120-
Array.from(nats(6).windows(100, "only full")),
120+
Array.from(nats(6).windows(100, "only-full")),
121121
[],
122122
);
123123
assert.deepEqual(
124-
Array.from(nats(6).windows(100, "allow partial")),
124+
Array.from(nats(6).windows(100, "allow-partial")),
125125
[[0, 1, 2, 3, 4, 5]],
126126
);
127127

@@ -134,32 +134,32 @@ test('windows', async t => {
134134
[],
135135
);
136136
assert.deepEqual(
137-
Array.from(nats(0).windows(2, "only full")),
137+
Array.from(nats(0).windows(2, "only-full")),
138138
[],
139139
);
140140
assert.deepEqual(
141-
Array.from(nats(0).windows(2, "allow partial")),
141+
Array.from(nats(0).windows(2, "allow-partial")),
142142
[],
143143
);
144144

145145
assert.throws(() => {
146146
nats(1).windows()
147147
}, RangeError);
148148
assert.throws(() => {
149-
nats(1).windows(undefined, "only full")
149+
nats(1).windows(undefined, "only-full")
150150
}, RangeError);
151151
assert.throws(() => {
152-
nats(1).windows(undefined, "allow partial")
152+
nats(1).windows(undefined, "allow-partial")
153153
}, RangeError);
154154

155155
assert.throws(() => {
156156
nats(1).windows([2]);
157157
}, RangeError);
158158
assert.throws(() => {
159-
nats(1).windows([2], "only full");
159+
nats(1).windows([2], "only-full");
160160
}, RangeError);
161161
assert.throws(() => {
162-
nats(1).windows([2], "allow partial");
162+
nats(1).windows([2], "allow-partial");
163163
}, RangeError);
164164

165165
assert.throws(() => {
@@ -169,10 +169,10 @@ test('windows', async t => {
169169
nats(1).windows(0, undefined);
170170
}, RangeError);
171171
assert.throws(() => {
172-
nats(1).windows(0, "only full");
172+
nats(1).windows(0, "only-full");
173173
}, RangeError);
174174
assert.throws(() => {
175-
nats(1).windows(0, "allow partial");
175+
nats(1).windows(0, "allow-partial");
176176
}, RangeError);
177177

178178
assert.throws(() => {
@@ -182,10 +182,10 @@ test('windows', async t => {
182182
nats(1).windows(-1, undefined);
183183
}, RangeError);
184184
assert.throws(() => {
185-
nats(1).windows(-1, "only full");
185+
nats(1).windows(-1, "only-full");
186186
}, RangeError);
187187
assert.throws(() => {
188-
nats(1).windows(-1, "allow partial");
188+
nats(1).windows(-1, "allow-partial");
189189
}, RangeError);
190190

191191
assert.throws(() => {
@@ -195,10 +195,10 @@ test('windows', async t => {
195195
nats(1).windows(1.5, undefined);
196196
}, RangeError);
197197
assert.throws(() => {
198-
nats(1).windows(1.5, "only full");
198+
nats(1).windows(1.5, "only-full");
199199
}, RangeError);
200200
assert.throws(() => {
201-
nats(1).windows(1.5, "allow partial");
201+
nats(1).windows(1.5, "allow-partial");
202202
}, RangeError);
203203

204204
assert.throws(() => {
@@ -208,10 +208,10 @@ test('windows', async t => {
208208
nats(1).windows(Math.pow(2, 53), undefined);
209209
}, RangeError);
210210
assert.throws(() => {
211-
nats(1).windows(Math.pow(2, 53), "only full");
211+
nats(1).windows(Math.pow(2, 53), "only-full");
212212
}, RangeError);
213213
assert.throws(() => {
214-
nats(1).windows(Math.pow(2, 53), "allow partial");
214+
nats(1).windows(Math.pow(2, 53), "allow-partial");
215215
}, RangeError);
216216

217217
assert.throws(() => {

0 commit comments

Comments
 (0)