How to use the css-line-break.fromCodePoint function in css-line-break

To help you get started, we’ve selected a few css-line-break examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github niklasvh / html2canvas / src / css / syntax / tokenizer.ts View on Github external
if (isWhiteSpace(codePoint)) {
            this.consumeWhiteSpace();
            return WHITESPACE_TOKEN;
        }

        if (isDigit(codePoint)) {
            this.reconsumeCodePoint(codePoint);
            return this.consumeNumericToken();
        }

        if (isNameStartCodePoint(codePoint)) {
            this.reconsumeCodePoint(codePoint);
            return this.consumeIdentLikeToken();
        }

        return {type: TokenType.DELIM_TOKEN, value: fromCodePoint(codePoint)};
    }
github niklasvh / html2canvas / src / css / syntax / tokenizer.ts View on Github external
if (codePoint === LINE_FEED) {
                this._value.splice(0, i);
                return BAD_STRING_TOKEN;
            }

            if (codePoint === REVERSE_SOLIDUS) {
                const next = this._value[i + 1];
                if (next !== EOF && next !== undefined) {
                    if (next === LINE_FEED) {
                        value += this.consumeStringSlice(i);
                        i = -1;
                        this._value.shift();
                    } else if (isValidEscape(codePoint, next)) {
                        value += this.consumeStringSlice(i);
                        value += fromCodePoint(this.consumeEscapedCodePoint());
                        i = -1;
                    }
                }
            }

            i++;
        } while (true);
    }
github niklasvh / html2canvas / src / css / syntax / tokenizer.ts View on Github external
}
            }

            this.consumeBadUrlRemnants();
            return BAD_URL_TOKEN;
        }

        while (true) {
            const codePoint = this.consumeCodePoint();
            if (codePoint === EOF || codePoint === RIGHT_PARENTHESIS) {
                return {type: TokenType.URL_TOKEN, value: fromCodePoint(...value)};
            } else if (isWhiteSpace(codePoint)) {
                this.consumeWhiteSpace();
                if (this.peekCodePoint(0) === EOF || this.peekCodePoint(0) === RIGHT_PARENTHESIS) {
                    this.consumeCodePoint();
                    return {type: TokenType.URL_TOKEN, value: fromCodePoint(...value)};
                }
                this.consumeBadUrlRemnants();
                return BAD_URL_TOKEN;
            } else if (
                codePoint === QUOTATION_MARK ||
                codePoint === APOSTROPHE ||
                codePoint === LEFT_PARENTHESIS ||
                isNonPrintableCodePoint(codePoint)
            ) {
                this.consumeBadUrlRemnants();
                return BAD_URL_TOKEN;
            } else if (codePoint === REVERSE_SOLIDUS) {
                if (isValidEscape(codePoint, this.peekCodePoint(0))) {
                    value.push(this.consumeEscapedCodePoint());
                } else {
                    this.consumeBadUrlRemnants();
github niklasvh / html2canvas / src / css / syntax / tokenizer.ts View on Github external
private consumeEscapedCodePoint(): number {
        const codePoint = this.consumeCodePoint();

        if (isHex(codePoint)) {
            let hex = fromCodePoint(codePoint);
            while (isHex(this.peekCodePoint(0)) && hex.length < 6) {
                hex += fromCodePoint(this.consumeCodePoint());
            }

            if (isWhiteSpace(this.peekCodePoint(0))) {
                this.consumeCodePoint();
            }

            const hexCodePoint = parseInt(hex, 16);

            if (hexCodePoint === 0 || isSurrogateCodePoint(hexCodePoint) || hexCodePoint > 0x10ffff) {
                return REPLACEMENT_CHARACTER;
            }

            return hexCodePoint;
        }

        if (codePoint === EOF) {
github niklasvh / html2canvas / src / css / syntax / tokenizer.ts View on Github external
private consumeName(): string {
        let result = '';
        while (true) {
            const codePoint = this.consumeCodePoint();
            if (isNameCodePoint(codePoint)) {
                result += fromCodePoint(codePoint);
            } else if (isValidEscape(codePoint, this.peekCodePoint(0))) {
                result += fromCodePoint(this.consumeEscapedCodePoint());
            } else {
                this.reconsumeCodePoint(codePoint);
                return result;
            }
        }
    }
}
github niklasvh / html2canvas / src / css / syntax / tokenizer.ts View on Github external
private consumeName(): string {
        let result = '';
        while (true) {
            const codePoint = this.consumeCodePoint();
            if (isNameCodePoint(codePoint)) {
                result += fromCodePoint(codePoint);
            } else if (isValidEscape(codePoint, this.peekCodePoint(0))) {
                result += fromCodePoint(this.consumeEscapedCodePoint());
            } else {
                this.reconsumeCodePoint(codePoint);
                return result;
            }
        }
    }
}
github niklasvh / html2canvas / src / css / syntax / tokenizer.ts View on Github external
private consumeStringSlice(count: number): string {
        const SLICE_STACK_SIZE = 60000;
        let value = '';
        while (count > 0) {
            const amount = Math.min(SLICE_STACK_SIZE, count);
            value += fromCodePoint(...this._value.splice(0, amount));
            count -= amount;
        }
        this._value.shift();

        return value;
    }

css-line-break

css-line-break ==============

MIT
Latest version published 3 years ago

Package Health Score

67 / 100
Full package analysis