@vunk/shared

bubbleSort

跳过 undefined 的冒泡排序

Test

ts
import { expect, test } from "vitest";
import { bubbleSort } from '../bubbleSort'


test("bubbleSort", async () => {

  const b = bubbleSort([
    { index: undefined, name: 'a' },
    { index: 3 },
    { index: undefined, name: 'b' },
    { index: 2 },
    { index: 1 },
  ])


  b
  
})

array/__tests__/bubbleSort.test.ts