mirror of
https://github.com/discourse/discourse.git
synced 2024-12-12 17:43:43 +08:00
0fa92529ed
* Enable "plain function as helpers" polyfill This feature landed in Ember 4.5+, but this polyfill would allow it to work on 3.25+ References RFC: https://github.com/emberjs/rfcs/pull/756 Update: https://github.com/emberjs/rfcs/pull/788 Guides: https://github.com/ember-learn/guides-source/pull/1924 * Convert truth-helpers to use plain functions Mainly to test that the polyfill is working, but it's a good refactor anyway.
12 lines
265 B
JavaScript
12 lines
265 B
JavaScript
export default function lte(left, right, { forceNumber = false } = {}) {
|
|
if (forceNumber) {
|
|
if (typeof left !== "number") {
|
|
left = Number(left);
|
|
}
|
|
if (typeof right !== "number") {
|
|
right = Number(right);
|
|
}
|
|
}
|
|
return left <= right;
|
|
}
|