lib/runtime/values.js
function(value) {
        switch (typeof value) {
            case 'boolean':
                return 'Boolean';

            case 'number':
                return 'Number';

            case 'string':
                return 'String';

            case 'object':
                if (value === null) {
                    return 'Null';
                } else {
                    switch (Object.prototype.toString.call(value)) {
                        case '[object RegExp]':
                            return 'RegExp';

                        case '[object Array]':
                            return 'Array';

                        case '[object Object]':
                            switch (value.constructor) {
                                case JuttleMoment:
                                    if (value.moment) {
                                        return 'Date';
                                    }
                                    if (value.duration) {
                                        return 'Duration';
                                    }
                                    break;   // silence ESLint

                                case Filter:
                                    return 'Filter';

                                case Object:
                                    return 'Object';
                            }
                    }
                }
        }

        throw new Error('Invalid Juttle value: ' + value + '.');
    }
function(value) {
        switch (typeof value) {
            case 'boolean':
                return 'Boolean';

            case 'number':
                return 'Number';

            case 'string':
                return 'String';

            case 'object':
                if (value === null) {
                    return 'Null';
                } else {
                    switch (Object.prototype.toString.call(value)) {
                        case '[object RegExp]':
                            return 'RegExp';

                        case '[object Array]':
                            return 'Array';

                        case '[object Object]':
                            switch (value.constructor) {
                                case JuttleMoment:
                                    if (value.moment) {
                                        return 'Date';
                                    }
                                    if (value.duration) {
                                        return 'Duration';
                                    }
                                    break;   // silence ESLint

                                case Filter:
                                    return 'Filter';

                                case Object:
                                    return 'Object';
                            }
                    }
                }
        }

        throw new Error('Invalid Juttle value: ' + value + '.');
    }
function ( value ) { switch ( typeof value ) { case 'boolean' : return 'Boolean' ; case 'number' : return 'Number' ; case 'string' : return 'String' ; case 'object' : if ( value === null ) { return 'Null' ; } else { switch ( Object . prototype . toString . call ( value ) ) { case '[object RegExp]' : return 'RegExp' ; case '[object Array]' : return 'Array' ; case '[object Object]' : switch ( value . constructor ) { case JuttleMoment : if ( value . moment ) { return 'Date' ; } if ( value . duration ) { return 'Duration' ; } break ; // silence ESLint case Filter : return 'Filter' ; case Object : return 'Object' ; } } } } throw new Error ( 'Invalid Juttle value: ' + value + '.' ) ; }
Returns a Juttle type represented by a JavaScript value. Throws an exception if the JavaScript value doesn't represent any Juttle type.
Returns a Juttle type represented by a JavaScript value . Throws an exception if the JavaScript value doesn t represent any Juttle type .