filters.js 403 B

123456789101112131415161718
  1. /* eslint-disable func-names */
  2. /* eslint-disable no-param-reassign */
  3. import _ from 'lodash';
  4. import moment from 'moment';
  5. export function dict(value, codes) {
  6. if (!value) return '';
  7. value = value.toString();
  8. if (codes) {
  9. value = _.get(codes, [value]) || value;
  10. }
  11. return value;
  12. }
  13. export function date(value, formmat) {
  14. if (!value) return '';
  15. return moment(value).format(formmat);
  16. }