consul/ui/packages/consul-ui/app/helpers/json-stringify.js
Ronald 9d21736e9f
Add UI copyright headers files (#16614)
* Add copyright headers to UI files

* Ensure copywrite file ignores external libs
2023-03-14 09:18:55 -04:00

15 lines
317 B
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: MPL-2.0
*/
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]));
}
});