Function

helper (helper) public

Module: @ember/component

Available since v1.13.0

import { helper } from '@ember/component/helper';
helper
Function
The helper function

In many cases, the ceremony of a full Helper class is not required. The helper method create pure-function helpers without instances. For example:

currency.js
import { helper } from '@ember/component/helper';

export default helper(function(params, hash) {
  let cents = params[0];
  let currency = hash.currency;
  return `${currency}${cents * 0.01}`;
});

© 2020 Yehuda Katz, Tom Dale and Ember.js contributors
Licensed under the MIT License.
https://api.emberjs.com/ember/2.18/functions/@ember%2Fcomponent%2Fhelper/helper