Skip to content

zhuangya/node-schwartzian

Repository files navigation

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);

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Contributors 3

  •  
  •  
  •