consul/ui/packages/consul-ui/app/helpers/json-stringify.js

15 lines
318 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { helper } from '@ember/component/helper';
export default helper(function (args, hash) {
try {
return JSON.stringify(...args);
} catch (e) {
return args[0].map((item) => JSON.stringify(item, args[1], args[2]));
}
});