function createNode(value, t) {
    if (t.isIdentifier(value)) {
        return value;
    }

    if (Array.isArray(value)) {
        let elements = [];
        value.forEach(item => {
            let node = createNode(item, t);
            node && elements.push(node);
        });

        return t.arrayExpression(elements);
    }

    if (Object.prototype.toString.call(value) === '[object Object]') {
        let props = [];
        Object.keys(value).forEach(k => {
            let node = createNode(value[k], t);
            if (node) {
                props.push(t.objectProperty(
                    t.identifier(`'${k}'`),
                    node
                ));
            }
        });

        return t.objectExpression(props);
    }

    if (value == null) {
        return t.nullLiteral();
    }

    let valueType = typeof value;
    switch (valueType) {
        case 'boolean':
            return t.booleanLiteral(value);
        case 'string':
            return t.stringLiteral(value);
        case 'number':
            return t.numericLiteral(value);
    }
}
function createNode(value, t) {
    if (t.isIdentifier(value)) {
        return value;
    }

    if (Array.isArray(value)) {
        let elements = [];
        value.forEach(item => {
            let node = createNode(item, t);
            node && elements.push(node);
        });

        return t.arrayExpression(elements);
    }

    if (Object.prototype.toString.call(value) === '[object Object]') {
        let props = [];
        Object.keys(value).forEach(k => {
            let node = createNode(value[k], t);
            if (node) {
                props.push(t.objectProperty(
                    t.identifier(`'${k}'`),
                    node
                ));
            }
        });

        return t.objectExpression(props);
    }

    if (value == null) {
        return t.nullLiteral();
    }

    let valueType = typeof value;
    switch (valueType) {
        case 'boolean':
            return t.booleanLiteral(value);
        case 'string':
            return t.stringLiteral(value);
        case 'number':
            return t.numericLiteral(value);
    }
}
function createNode ( value , t ) { if ( t . isIdentifier ( value ) ) { return value ; } if ( Array . isArray ( value ) ) { let elements = [ ] ; value . forEach ( item => { let node = createNode ( item , t ) ; node && elements . push ( node ) ; } ) ; return t . arrayExpression ( elements ) ; } if ( Object . prototype . toString . call ( value ) === '[object Object]' ) { let props = [ ] ; Object . keys ( value ) . forEach ( k => { let node = createNode ( value [ k ] , t ) ; if ( node ) { props . push ( t . objectProperty ( t . identifier ( ` ${ k } ` ) , node ) ) ; } } ) ; return t . objectExpression ( props ) ; } if ( value == null ) { return t . nullLiteral ( ) ; } let valueType = typeof value ; switch ( valueType ) { case 'boolean' : return t . booleanLiteral ( value ) ; case 'string' : return t . stringLiteral ( value ) ; case 'number' : return t . numericLiteral ( value ) ; } }
Create AST node by the given value

@inner
@param {*} value the value to create
@param {Object} t the babel type definition
@return {?Object}
Create AST node by the given value