Files
test-repo/scripts/build/shims/array-to-reversed.js
T
fisker Cheungandautofix-ci[bot] 7fb9875413 Allow plugin override builtin parsers when inferring parser (#17549)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-06-05 17:23:49 +08:00

14 lines
295 B
JavaScript

const arrayToReversed = (isOptionalObject, array) => {
if (isOptionalObject && (array === undefined || array === null)) {
return;
}
if (array.toReversed || !Array.isArray(array)) {
return array.toReversed();
}
return [...array].reverse();
};
export default arrayToReversed;