Skip to content

Commit

Permalink
Merge pull request #290 from Dewberrycat/refactor_sorting
Browse files Browse the repository at this point in the history
refactored sorting
  • Loading branch information
samgozman authored Apr 3, 2022
2 parents c87cdd0 + 7be7246 commit febfe66
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

Очень **приветствуются** добавления новых определений в [словарь](./src/dictionary/dictionary.ts) языка, а также поиск багов и расширение функционала!

Смотрите интервью о создании языка на канале Хекслет: [https://www.youtube.com/watch?v=Rk5wNGBIilM](https://www.youtube.com/watch?v=Rk5wNGBIilM)

[![yoptascript logo](./doc/Yopta2.png)](https://github.com/samgozman/YoptaScript/blob/master/CONTRIBUTE.md)

## Разработка
Expand Down
6 changes: 1 addition & 5 deletions src/dictionary/prepareArrayBeforeBuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ import { dictionary } from './dictionary';
* @param dick массив 2D массивов ключей
*/
export const sortDictionaryToFile = (dick: string[][]): void => {
dick.sort(function (a, b) {
if (a[1].length < b[1].length) return 1;
else if (a[1].length > b[1].length) return -1;
else return 0;
});
dick.sort((a, b) => b[1].length - a[1].length);

const file = JSON.stringify(dick, null, '\t').replace(/\\/g, '');

Expand Down

0 comments on commit febfe66

Please sign in to comment.