Home

tailwind-ctp-intellisense @89138456160dcd7b56548b53210560200df4ad33 - refs - log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
tailwind-ctp-intellisense / packages / tailwindcss-language-service / src / util / array.ts
- raw
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
export function dedupe<T>(arr: Array<T>): Array<T> {
  return arr.filter((value, index, self) => self.indexOf(value) === index)
}

export function dedupeBy<T>(
  arr: Array<T>,
  transform: (item: T) => any
): Array<T> {
  return arr.filter(
    (value, index, self) =>
      self.map(transform).indexOf(transform(value)) === index
  )
}

export function ensureArray<T>(value: T | T[]): T[] {
  return Array.isArray(value) ? value : [value]
}

export function flatten<T>(arrays: T[][]): T[] {
  return [].concat.apply([], arrays)
}

export function equal(arr1: any[], arr2: any[]): boolean {
  return (
    JSON.stringify(arr1.concat([]).sort()) ===
    JSON.stringify(arr2.concat([]).sort())
  )
}