Skip to content

Commit

Permalink
Remove stable package in favor of native stable sort
Browse files Browse the repository at this point in the history
For Node.JS since version 12 sort is already stable.
  • Loading branch information
boidolr committed Dec 9, 2023
1 parent 67b99ce commit b40b29a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions generator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import commandLineArgs from "command-line-args"
import fs from "fs-extra"
import stable from "stable"
import chunk from "lodash.chunk";
import template from "lodash.template";
import imagemin from "imagemin";
Expand Down Expand Up @@ -279,7 +278,7 @@ async function parse() {

const result = new Map();
const filteredEmojiData = emojiData.filter(it => it.category !== "Component");
const preparedEmojiData = stable(filteredEmojiData, (first, second) => first.sort_order - second.sort_order);
const preparedEmojiData = [...filteredEmojiData].sort((first, second) => first.sort_order - second.sort_order);

for (const dataEntry of preparedEmojiData) {
const category = dataEntry.category.replace(" & ", "And");
Expand Down Expand Up @@ -392,7 +391,7 @@ async function generateCode(map, targets) {
const emojiProviderCompatTemplate = await fs.readFile("template/EmojiProviderCompat.kt", "utf-8");
const emojiProviderJvm = await fs.readFile("template/EmojiProviderJvm.kt", "utf-8");

const entries = stable([...map.entries()], (first, second) => {
const entries = [...map.entries()].sort((first, second) => {
return categoryInfo.findIndex(it => it.name === first[0]) - categoryInfo.findIndex(it => it.name === second[0]);
});

Expand Down
3 changes: 1 addition & 2 deletions generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"imagemin-zopfli": "^7.0.0",
"jimp": "^0.22.0",
"lodash.chunk": "^4.2.0",
"lodash.template": "^4.5.0",
"stable": "^0.1.6"
"lodash.template": "^4.5.0"
}
}

0 comments on commit b40b29a

Please sign in to comment.