This repository has been archived on 2023-03-18. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
osr-discourse-src/app/assets/javascripts/discourse/app/helpers/editable-value.js
T
2020-12-01 15:31:26 -03:00

21 lines
513 B
JavaScript

import Helper from "@ember/component/helper";
import { get } from "@ember/object";
export function formatCurrency([reviewable, fieldId]) {
// The field `category_id` corresponds to `category`
if (fieldId === "category_id") {
fieldId = "category.id";
}
let value = get(reviewable, fieldId);
// If it's an array, say tags, make a copy so we aren't mutating the original
if (Array.isArray(value)) {
value = value.slice(0);
}
return value;
}
export default Helper.helper(formatCurrency);