mirror of
https://github.com/discourse/discourse.git
synced 2025-02-24 02:21:55 +08:00

The implemented helpers, are helper which might be in Ember core in the future: - and - or - not - eq - not-eq - lt - lte - gt - gte They follow the implementation of ember-truth-helpers: https://github.com/jmurphyau/ember-truth-helpers Note 1: Ember rfcs are still debating going with {{not-eq}} or {{neq}}, should be easy to support in the future whatever is finally chosen. Note 2: this commit also moves it to its own addon, and removes the {{not}} test, to simplify further updates.
14 lines
336 B
JavaScript
14 lines
336 B
JavaScript
import Helper from "@ember/component/helper";
|
|
import truthConvert from "../utils/truth-convert";
|
|
|
|
export function and(params) {
|
|
for (let i = 0, len = params.length; i < len; i++) {
|
|
if (truthConvert(params[i]) === false) {
|
|
return params[i];
|
|
}
|
|
}
|
|
return params[params.length - 1];
|
|
}
|
|
|
|
export default Helper.helper(and);
|