diff --git a/CHANGELOG.md b/CHANGELOG.md index ef086c154..dcc899c74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/basis/ListBasis.test.ts b/src/basis/ListBasis.test.ts index a8c7ecde5..a04045af0 100644 --- a/src/basis/ListBasis.test.ts +++ b/src/basis/ListBasis.test.ts @@ -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'], diff --git a/src/values/TextValue.ts b/src/values/TextValue.ts index f73c4ba78..1c7641e62 100644 --- a/src/values/TextValue.ts +++ b/src/values/TextValue.ts @@ -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); }