Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/token/internal/guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ export function IsString(value: unknown): value is string {
export function IsEqual(left: unknown, right: unknown): boolean {
return left === right
}
export function TakeLeft<T, True extends (left: T, right: T[]) => unknown, False extends () => unknown>(array: T[], true_: True, false_: False): ReturnType<True> | ReturnType<False> {
export function ShiftLeft<T, True extends (left: T, right: T[]) => unknown, False extends () => unknown>(array: T[], true_: True, false_: False): ReturnType<True> | ReturnType<False> {
return (IsEqual(array.length, 0) ? false_() : true_(array[0], array.slice(1))) as never
}
2 changes: 1 addition & 1 deletion src/token/internal/take.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function Take<Variants extends string[], Input extends string>(variants:
// ----------------------------------------------------------------
// Symmetric
// ----------------------------------------------------------------
// return Guard.TakeLeft(variants, (valueLeft, valueRight) =>
// return Guard.ShiftLeft(variants, (valueLeft, valueRight) =>
// Match(TakeVariant(valueLeft, input), (take, rest) =>
// [take, rest],
// () => Take(valueRight, input)),
Expand Down
4 changes: 2 additions & 2 deletions src/token/until.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ THE SOFTWARE.
// deno-fmt-ignore-file

import { Match } from './internal/match.ts'
import { IsEqual, TakeLeft } from './internal/guard.ts'
import { IsEqual, ShiftLeft } from './internal/guard.ts'

// ------------------------------------------------------------------
// TakeOne
Expand All @@ -55,7 +55,7 @@ type TIsInputMatchSentinal<End extends string[], Input extends string> = (
: false
)
function IsInputMatchSentinal<End extends string[], Input extends string>(end: [...End], input: Input): TIsInputMatchSentinal<End, Input> {
return TakeLeft(end, (left, right) =>
return ShiftLeft(end, (left, right) =>
input.startsWith(left)
? true
: IsInputMatchSentinal(right, input),
Expand Down
2 changes: 1 addition & 1 deletion tasks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Task } from 'tasksmith'

const VERSION = '0.11.5'
const VERSION = '0.11.6'

// ------------------------------------------------------------------
// Clean
Expand Down
Loading