All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.funnysaltyfish.partialjsonparser.tokenizer.utils.kt Maven / Gradle / Ivy

Go to download

Parse incomplete JSON (like what ChatGPT generates in stream mode) in Kotlin, obtain as much as possible information fastly.

There is a newer version: 1.0.2
Show newest version
package com.funnysaltyfish.partialjsonparser.tokenizer

import com.funnysaltyfish.partialjsonparser.ParseContext

/**
 * import { ParseContext } from '../types';
 *
 * export function isEnd(context: ParseContext) {
 *   return context.index >= context.source.length;
 * }
 *
 * export function isIndexEnd(context: ParseContext, index: number) {
 *   return index >= context.source.length;
 * }
 *
 */

internal fun isEnd(context: ParseContext): Boolean {
    return context.index >= context.source.length
}

internal fun isIndexEnd(context: ParseContext, index: Int): Boolean {
    return index >= context.source.length
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy