Sha256: a6b4f7fdd4eee38474f85a7b9cc77aa4ab816913627ea5da930d7f6a7e077d09

Contents?: true

Size: 1.14 KB

Versions: 44

Compression:

Stored size: 1.14 KB

Contents

/**
 * @fileoverview Define the cursor which ignores the first few tokens.
 * @author Toru Nagashima
 */
"use strict";

//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------

const DecorativeCursor = require("./decorative-cursor");

//------------------------------------------------------------------------------
// Exports
//------------------------------------------------------------------------------

/**
 * The decorative cursor which ignores the first few tokens.
 */
module.exports = class SkipCursor extends DecorativeCursor {

    /**
     * Initializes this cursor.
     * @param {Cursor} cursor - The cursor to be decorated.
     * @param {number} count - The count of tokens this cursor skips.
     */
    constructor(cursor, count) {
        super(cursor);
        this.count = count;
    }

    /** @inheritdoc */
    moveNext() {
        while (this.count > 0) {
            this.count -= 1;
            if (!super.moveNext()) {
                return false;
            }
        }
        return super.moveNext();
    }
};

Version data entries

44 entries across 44 versions & 2 rubygems

Version Path
govuk_publishing_components-18.0.0 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.21.0 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.20.0 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.19.1 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.19.0 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.18.0 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.17.0 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.16.0 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.15.0 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.14.0 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.13.0 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.12.2 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.12.1 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.12.0 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.11.0 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.10.0 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.9.0 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.8.0 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.7.0 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js
govuk_publishing_components-17.6.1 node_modules/standard/node_modules/eslint/lib/token-store/skip-cursor.js