Skip to content

Commit

Permalink
Fixed text sorting.
Browse files Browse the repository at this point in the history
  • Loading branch information
amyjko committed Jul 22, 2024
1 parent ca85551 commit 18ae656
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
We'll note all notable changes in this file, including bug fixes, enhancements, and all closed issues.
Dates are in `YYYY-MM-DD` format and versions are in [semantic versioning](http://semver.org/) format.

## 0.10.7 2024-07-27

### Fixed

- Fixed text sorting.

## 0.10.6 2024-07-20

### Added
Expand Down
2 changes: 2 additions & 0 deletions src/basis/ListBasis.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ test.each([
['[5 2 3 4 1].sorted()', '[1 2 3 4 5]'],
['["e" "d" "c" "b" "a"].sorted()', '["a" "b" "c" "d" "e"]'],
['["e" "b" "a" "c" "d"].sorted()', '["a" "b" "c" "d" "e"]'],
['["zzz" "yy" "x"].sorted()', '["x" "yy" "zzz"]'],
['["zzz" "π" "yy" "x"].sorted()', '["x" "yy" "zzz" "π"]'],
['[ø ø ø].sorted()', '[ø ø ø]'],
['[ø "hi" ø].sorted()', '[ø ø "hi"]'],
['[{3 2 1} {} {1 2}].sorted()', '!ConversionException'],
Expand Down
2 changes: 1 addition & 1 deletion src/values/TextValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default class TextValue extends SimpleValue {
let sum = 0;
for (let i = 0; i < this.text.length; i++) {
const codepoint = this.text.codePointAt(i) ?? 0;
sum += codepoint * Math.pow(10, 3 - this.text.length - 1);
sum += codepoint * Math.pow(10, -i);
}
return new NumberValue(requestor, sum);
}
Expand Down

0 comments on commit 18ae656

Please sign in to comment.