public static Scriptable toObjectOrNull(Context cx, Object obj,
                                            Scriptable scope)
    {
        if (obj instanceof Scriptable) {
            return (Scriptable)obj;
        } else if (obj != null && obj != Undefined.instance) {
            return toObject(cx, scope, obj);
        }
        return null;
    }
public static Scriptable toObjectOrNull ( Context cx , Object obj , Scriptable scope ) { if ( obj instanceof Scriptable ) { return ( Scriptable ) obj ; } else if ( obj != null && obj != Undefined . instance ) { return toObject ( cx , scope , obj ) ; } return null ; }
@param scope the scope that should be used to resolve primitive prototype