<commit_before>var RNSync = require( 'react-native' ).NativeModules.RNSync;

var noop = function(){};

var Sync = {

    init: function ( cloudantServerUrl, databaseName, callback )
    {
        callback = callback || noop;

        var databaseUrl = cloudantServerUrl + '/' + databaseName;

        return fetch( databaseUrl, {
            method: 'PUT'
        } )
            .then( ( response ) =>
            {
                if ( response.status == 201 || response.status == 412 )
                {
                    RNSync.init( databaseUrl, callback );
                }
                else
                {
                    callback && callback( 'error: (' + response.status + ') ' + response._bodyInit );
                }
            } )
            .catch( ( error ) =>
            {
                callback && callback( error );
            } )
    },

    create: function ( body, id, callback )
    {
        callback = callback || noop;

        RNSync.create( body, id, callback );
    },

    retrieve: function ( id, callback )
    {
        RNSync.retrieve( id, callback );
    },

    findOrCreate: function ( id, callback )
    {
        RNSync.retrieve( id, function ( err, doc )
        {
            if ( err === 404 )
            {
                this.create( null, id, callback )
            }
            else
            {
                callback( err, doc );
            }
        }.bind( this ) );
    },

    update: function ( id, rev, body, callback )
    {
        callback = callback || noop;

        RNSync.update( id, rev, body, callback );
    },

    delete: function ( id, callback )
    {
        callback = callback || noop;

        RNSync.delete( id, callback );
    },

    replicate: function ( successCallback, errorCallback )
    {
        successCallback = successCallback || noop;
        errorCallback = errorCallback || noop;

        RNSync.replicate( successCallback, errorCallback );
    },

    addAttachment: function ( id, name, path, type, callback )
    {
        callback = callback || noop;

        RNSync.addAttachment( id, name, path, type, callback );
    },

    find: function( query, callback)
    {
        RNSync.find( query, callback );
    }
};
<commit_msg>just returning the docs instead of array of params<commit_after>var RNSync = require( 'react-native' ).NativeModules.RNSync;

var noop = function(){};

var Sync = {

    init: function ( cloudantServerUrl, databaseName, callback )
    {
        callback = callback || noop;

        var databaseUrl = cloudantServerUrl + '/' + databaseName;

        return fetch( databaseUrl, {
            method: 'PUT'
        } )
            .then( ( response ) =>
            {
                if ( response.status == 201 || response.status == 412 )
                {
                    RNSync.init( databaseUrl, callback );
                }
                else
                {
                    callback && callback( 'error: (' + response.status + ') ' + response._bodyInit );
                }
            } )
            .catch( ( error ) =>
            {
                callback && callback( error );
            } )
    },

    create: function ( body, id, callback )
    {
        callback = callback || noop;

        RNSync.create( body, id, callback );
    },

    retrieve: function ( id, callback )
    {
        RNSync.retrieve( id, callback );
    },

    findOrCreate: function ( id, callback )
    {
        RNSync.retrieve( id, function ( err, doc )
        {
            if ( err === 404 )
            {
                this.create( null, id, callback )
            }
            else
            {
                callback( err, doc );
            }
        }.bind( this ) );
    },

    update: function ( id, rev, body, callback )
    {
        callback = callback || noop;

        RNSync.update( id, rev, body, callback );
    },

    delete: function ( id, callback )
    {
        callback = callback || noop;

        RNSync.delete( id, callback );
    },

    replicate: function ( successCallback, errorCallback )
    {
        successCallback = successCallback || noop;
        errorCallback = errorCallback || noop;

        RNSync.replicate( successCallback, errorCallback );
    },

    addAttachment: function ( id, name, path, type, callback )
    {
        callback = callback || noop;

        RNSync.addAttachment( id, name, path, type, callback );
    },

    find: function( query, callback)
    {
        RNSync.find( query, function(err, params)
        {
            callback(err, params[0]);
        });
    }
};

{'fraction_non_alphanumeric': 0.11773667029379761, 'fraction_numerical': 0.004134929270946681, 'mean_word_length': 1.4722969338353953, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5717803', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1232, 'n_words': 309}