mirror of
https://github.com/strapi/strapi.git
synced 2025-09-19 13:31:34 +00:00
Prevent all bugs from strings
This commit is contained in:
parent
93b190eada
commit
69ae95726f
@ -7,7 +7,7 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import moment from 'moment';
|
||||
import { isEmpty, isNull, isObject, toString } from 'lodash';
|
||||
import { isEmpty, isNull, isObject, toLower, toString } from 'lodash';
|
||||
import cn from 'classnames';
|
||||
|
||||
import CustomInputCheckbox from 'components/CustomInputCheckbox';
|
||||
@ -31,21 +31,17 @@ class TableRow extends React.Component {
|
||||
* @returns {*}
|
||||
*/
|
||||
getDisplayedValue(type, value, name) {
|
||||
if (!value) {
|
||||
return '-';
|
||||
}
|
||||
|
||||
switch (type.toLowerCase()) {
|
||||
switch (toLower(type)) {
|
||||
case 'string':
|
||||
case 'text':
|
||||
case 'email':
|
||||
case 'enumeration':
|
||||
return (value && !isEmpty(value.toString())) || name === 'id' ? value.toString() : '-';
|
||||
return (value && !isEmpty(toString(value))) || name === 'id' ? toString(value) : '-';
|
||||
case 'float':
|
||||
case 'integer':
|
||||
case 'biginteger':
|
||||
case 'decimal':
|
||||
return !isNull(value) ? value.toString() : '-';
|
||||
return !isNull(value) ? toString(value) : '-';
|
||||
case 'boolean':
|
||||
return value !== null ? toString(value) : '-';
|
||||
case 'date':
|
||||
|
Loading…
x
Reference in New Issue
Block a user