All files / src/repository/utility transform-value.ts

100% Statements 5/5
100% Branches 2/2
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19                1034x 414x 336x       620x     20x  
import FieldValue from 'type/field-value';
import PrimitiveTransformer from 'repository/interface/primitive-transformer';
 
function transformValue(
	value: FieldValue,
	hostname: string,
	transformer: PrimitiveTransformer
): FieldValue {
	if (Array.isArray(value)) {
		return value.map((value) => {
			return transformer(value, hostname);
		});
	}
 
	return transformer(value, hostname);
}
 
export default transformValue;