All files / src order-by.ts

100% Statements 8/8
100% Branches 2/2
100% Functions 2/2
100% Lines 6/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 1022x 22x 22x     22x 4x   22x  
import id, { type Identifier } from './identifier.js'
import list from './list.js'
import raw from './raw.js'
 
const orderBy =
  (terms: [identifier: undefined | Identifier, direction: 'asc' | 'desc'][]) =>
    list(terms.map(_ => _?.[0] != null ? raw(`${id(_[0])} ${_[1]}`) : undefined))
 
export default orderBy