MCPcopy Create free account
hub / github.com/LearnPrompt/LearnPrompt / difference

Function difference

src/utils/jsUtils.ts:2–4  ·  view source on GitHub ↗
(...arrays: T[][])

Source from the content-addressed store, hash-verified

1// Inspired by https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_difference
2export function difference<T>(...arrays: T[][]): T[] {
3 return arrays.reduce((a, b) => a.filter(c => !b.includes(c)))
4}
5
6// Inspired by https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_sortby-and-_orderby
7export function sortBy<T>(array: T[], getter: (item: T) => string | number | boolean): T[] {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected