UNPKG

@akala/core

Version:
25 lines 732 B
/** * A formatter that returns the input value unchanged. * This is useful for scenarios where no transformation is needed. */ export default class Slice { start; end; constructor(settings) { if (typeof settings === 'number') { settings = { start: 0, end: settings }; } this.start = settings.start ?? 0; this.end = settings.end ?? Infinity; } /** * Returns the input value without modification. * @template T - The type of the input value. * @param {T} value - The value to format. * @returns {T} The same input value. */ format(value) { return value?.slice(this.start, this.end) || []; } } //# sourceMappingURL=slice.js.map