mirror of
https://git.stupid.fish/teidesu/scripts.git
synced 2025-07-27 18:22:10 +10:00
chore: update public repo
This commit is contained in:
parent
f02ccb6029
commit
655e5a8e15
3 changed files with 32 additions and 26 deletions
|
@ -1,8 +1,13 @@
|
||||||
import antfu from '@antfu/eslint-config'
|
import antfu from '@antfu/eslint-config'
|
||||||
|
|
||||||
export default antfu({
|
export default antfu({
|
||||||
ignores: ['assets/'],
|
ignores: [
|
||||||
|
'assets/',
|
||||||
|
'node_modules/',
|
||||||
|
'dist/',
|
||||||
|
],
|
||||||
typescript: true,
|
typescript: true,
|
||||||
|
gitignore: false,
|
||||||
rules: {
|
rules: {
|
||||||
'curly': ['error', 'multi-line'],
|
'curly': ['error', 'multi-line'],
|
||||||
'style/brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
'style/brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
||||||
|
|
|
@ -12,28 +12,4 @@ export const ffetchShiki = ffetchBase.extend({
|
||||||
...(rateLimitBypass as any),
|
...(rateLimitBypass as any),
|
||||||
})
|
})
|
||||||
|
|
||||||
export function counterIter(start = 0, end = Infinity) {
|
export { counterIter } from '../../../utils/counter.ts'
|
||||||
let i = start
|
|
||||||
let ended = false
|
|
||||||
|
|
||||||
const iter: IterableIterator<number> = {
|
|
||||||
[Symbol.iterator]: () => iter,
|
|
||||||
next() {
|
|
||||||
if (ended) {
|
|
||||||
return { value: undefined, done: true }
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i > end) {
|
|
||||||
return { value: undefined, done: true }
|
|
||||||
}
|
|
||||||
|
|
||||||
return { value: i++, done: false }
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
iter,
|
|
||||||
end: () => {
|
|
||||||
ended = true
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
25
utils/counter.ts
Normal file
25
utils/counter.ts
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
export function counterIter(start = 0, end = Infinity) {
|
||||||
|
let i = start
|
||||||
|
let ended = false
|
||||||
|
|
||||||
|
const iter: IterableIterator<number> = {
|
||||||
|
[Symbol.iterator]: () => iter,
|
||||||
|
next() {
|
||||||
|
if (ended) {
|
||||||
|
return { value: undefined, done: true }
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i > end) {
|
||||||
|
return { value: undefined, done: true }
|
||||||
|
}
|
||||||
|
|
||||||
|
return { value: i++, done: false }
|
||||||
|
},
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
iter,
|
||||||
|
end: () => {
|
||||||
|
ended = true
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue