Skip to content

Pro203S/sortism

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sortism

ENGLISH

license stars

자신에게 맞는 방법으로 배열을 정렬해보세요!
이 모듈에는 여러가지의 정렬 방식이 있습니다.
자신에게 맞는 정렬을 사용하시면 됩니다.

사용법

  1. 패키지 설치
npm i sortism

bun i sortism
  1. 모듈 가져오기
import sortism from 'sortism';
  1. 정렬 사용하기
const arr = [5,2,3,1,4];

// 버블 정렬, 오름차순
// 1,2,3,4,5
sortism(arr).bubble("ascending");

// 선택 정렬, 내림차순
// 5,4,3,2,1
sortism(arr).selection("descending");

자세한 사용법

  • Object에서 정렬하기
const arr = [
    {
        "index": 2
    },
    {
        "index": 0
    },
    {
        "index": 2
    },
    {
        "index": 6
    },
    {
        "index": 4
    },
    {
        "index": 3
    }
];

// 버블 정렬, 오름차순
sortism(arr).bubble("ascending");

/*
returns:
[
  {
    index: 0,
  }, {
    index: 2,
  }, {
    index: 2,
  }, {
    index: 3,
  }, {
    index: 4,
  }, {
    index: 6,
  }
]
*/

지금 바로 설치해서 사용해보세요!

About

The easiest way to sort an array.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors