File size: 382 Bytes
4a288a7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

import getType from '../util/get_type';
import ValidationError from '../error/validation_error';

export default function validateString(options) {
    const value = options.value;
    const key = options.key;
    const type = getType(value);

    if (type !== 'string') {
        return [new ValidationError(key, value, `string expected, ${type} found`)];
    }

    return [];
}