src/utils/formatter.js
/**
	 * Filter fields from array of json objects
	 *
	 * @param {string} fields Fields to get in comma separated
	 * @param {Array} results Array of json objects.
	 * @returns {Array}
	 */
Filter fields from array of json objects
@param {string} fields Fields to get in comma separated
@param {Array} results Array of json objects.
@returns {Array}
Filter fields from array of json objects @param { string } fields Fields to get in comma separated @param { Array } results Array of json objects . @returns { Array }
static mappingFields(fields, results) {
		const truncate = (input) => {
			return input.length > 70 ? `${input.substring(0, 70)}...` : input;
		};
		return map(results, function (item) {
			const output = [];
			fields.split(',').forEach(function (field) {
				let value = item[field];
				if (Array.isArray(item[field])) {
					value = item[field].join(',');
				}
				if (typeof item[field] === 'string') {
					value = truncate(item[field]);
				}
				output.push(typeof item[field] === 'undefined' ? '' : value.toString());
			});
			return output;
		});
	}
static mappingFields ( fields , results ) { const truncate = ( input ) => { return input . length > 70 ? ` ${ input . substring ( 0 , 70 ) } ` : input ; } ; return map ( results , function ( item ) { const output = [ ] ; fields . split ( ',' ) . forEach ( function ( field ) { let value = item [ field ] ; if ( Array . isArray ( item [ field ] ) ) { value = item [ field ] . join ( ',' ) ; } if ( typeof item [ field ] === 'string' ) { value = truncate ( item [ field ] ) ; } output . push ( typeof item [ field ] === 'undefined' ? '' : value . toString ( ) ) ; } ) ; return output ; } ) ; }
Filter fields from array of json objects
 @param {string} fields Fields to get in comma separated
 @param {Array} results Array of json objects.
Filter fields from array of json objects @param { string } fields Fields to get in comma separated @param { Array } results Array of json objects .