Skip to content

Commit b41f9fa

Browse files
committed
Cleanup
1 parent c9ed34a commit b41f9fa

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

packages/jinja/src/runtime.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,6 @@ export class ObjectValue extends RuntimeValue<Map<string, AnyRuntimeValue>> {
349349
const aVal = a.value[index];
350350
const bVal = b.value[index];
351351

352-
// Use the shared comparison helper
353352
const result = compareRuntimeValues(aVal, bVal, caseSensitive.value);
354353
return reverse.value ? -result : result;
355354
});
@@ -870,7 +869,7 @@ export class Interpreter {
870869
case "reverse":
871870
return new ArrayValue(operand.value.slice().reverse());
872871
case "sort": {
873-
// Default case-insensitive sort using the shared comparison helper
872+
// Default to case-insensitive sort
874873
return new ArrayValue(operand.value.slice().sort((a, b) => compareRuntimeValues(a, b, false)));
875874
}
876875
case "join":
@@ -1082,19 +1081,12 @@ export class Interpreter {
10821081
return getAttributeValue(item, attrPath);
10831082
};
10841083

1085-
// Create a copy of the array to sort
1086-
const arrayCopy = operand.value.slice();
1087-
1088-
arrayCopy.sort((a, b) => {
1084+
return new ArrayValue(operand.value.slice().sort((a, b) => {
10891085
const aVal = getSortValue(a);
10901086
const bVal = getSortValue(b);
1091-
1092-
// Use the shared comparison helper
10931087
const result = compareRuntimeValues(aVal, bVal, caseSensitive.value);
10941088
return reverse.value ? -result : result;
1095-
});
1096-
1097-
return new ArrayValue(arrayCopy);
1089+
}));
10981090
}
10991091
case "selectattr":
11001092
case "rejectattr": {
@@ -1751,8 +1743,6 @@ function toJSON(
17511743
case "NullValue":
17521744
return "null";
17531745
case "UndefinedValue":
1754-
// When used for JSON serialization (tojson filter), convert to "null"
1755-
// When used for string conversion (string filter), keep as "undefined"
17561746
return convertUndefinedToNull ? "null" : "undefined";
17571747
case "IntegerValue":
17581748
case "FloatValue":

0 commit comments

Comments
 (0)