@zhuangya/schwartzian
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

Schwartzian transform in javascript

https://en.wikipedia.org/wiki/Schwartzian_transform

usage:

// index.mjs

// named export:
import { schwartzian } from "@zhuangya/schwartzian";

// OR default export
// import schwartzian from "@zhuangya/schwartzian";

function mapperFn({ weight }) {
  return weight;
}

function compareFn(a, b) {
  return a - b;
}

const data = [
  {
    weight: 1,
  },
  {
    weight: 9,
  },
  {
    weight: 5,
  },
];

schwartzian(data, mapperFn, compareFn);

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i @zhuangya/schwartzian

    Weekly Downloads

    1

    Version

    2.1.0

    License

    ISC

    Unpacked Size

    2.85 kB

    Total Files

    6

    Last publish

    Collaborators

    • zhuangya