/
drndsv
/
react
Обзор
Документация
Войти
/
drndsv
/
react
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
node_modules/eslint/lib/source-code/token-store/limit-cursor.js
40 строк
1 KB
drndsv
Initial commit
14 апр 2025, 22:53
14 апр 2025, 22:53
641ac8a
Код
Авторство
О чём код?
/** * @fileoverview Define the cursor which limits the number of tokens. * @author Toru Nagashima */ "use strict"; //------------------------------------------------------------------------------ // Requirements //------------------------------------------------------------------------------ const DecorativeCursor = require("./decorative-cursor"); //------------------------------------------------------------------------------ // Exports //------------------------------------------------------------------------------ /** * The decorative cursor which limits the number of tokens. */ module.exports = class LimitCursor extends DecorativeCursor { /** * Initializes this cursor. * @param {Cursor} cursor The cursor to be decorated. * @param {number} count The count of tokens this cursor iterates. */ constructor(cursor, count) { super(cursor); this.count = count; } /** @inheritdoc */ moveNext() { if (this.count > 0) { this.count -= 1; return super.moveNext(); } return false; } };