@sanity/mutator
Version:
A set of models to make it easier to utilize the powerful real time collaborative features of Sanity
13 lines (11 loc) • 387 B
text/typescript
import {type Expression} from '../jsonpath'
import {type ImmutableAccessor} from './ImmutableAccessor'
export function targetsToIndicies(targets: Expression[], accessor: ImmutableAccessor): number[] {
const result: number[] = []
targets.forEach((target) => {
if (target.isIndexReference()) {
result.push(...target.toIndicies(accessor))
}
})
return result.sort()
}