<commit_before>SofaJS
======
SofaJS is a library that makes it easy to communicate with a CouchDB server from the front end.

Setup
-----
  Sofa.server = "http://mydomain.com/path/to/couchdb/";
Before you can use SofaJS you must set the server path to your CouchDB instance. It requires the trailing "/".

Server Status
-------------
  // Sofa.getStatus(success[, error]);
  Sofa.getStatus(function (response) {
    console.log(response.couchdb + " " + response.version);
  }, function (status, message) {
    console.error(status + ": " + message);
  });
 
Get UUIDs
---------
  // Sofa.getUUIDs(num, success[, error]);
  Sofa.getUUIDs(5, function (uuids) {
    for (var i = 0; i < 5; i++) {
      docs[i]._id = uuids[i];
    }
  }, function (status, message) {
    console.error(status + ": " + message);
  });
 
Database Replication
--------------------
  // Sofa.replicate(options);
  Sofa.replicate({
    source : "foo",
    target : "foo_backup",
    success : function (response) {
      console.log("Database Backed Up: " + response);
    },
    error : function (status, message) {
      console.error(status + ": " + message);
    }
  });
 
Database Binding
----------------
  // new Sofa.DB(name);
  var db = new Sofa.DB("foo");
Sofa.DB is the binding required to interact with a CouchDB Database.

### Create
  // db.create(success[, error]);
  db.create(function (response) {
    console.log("Database Created: " + response);
  }, function (status, message) {
    console.error(status + ": " + message);
  });
Create the database if it doesn't already exist.

### Delete
  // db.del(success[, error]);
  db.del(function (response) {
    console.log("Database Deleted: " + response);
  }, function (status, message) {
    console.error(status + ": " + message);
  });
Delete the database if it exists.

### Get a Document
  // db.get(id, success[, error]);
  db.get("<KEY>", function (doc) {
    console.log("Retrieved Document: " + doc);
  }, function (status, message) {
    console.log(status + ": " + message);
  });
 
### Save a Document
  // db.save(doc, success[, error]);
  db.save(doc, function (response) {
    console.log("Saved Document: " + response);
  }, function (status, message) {
    console.error(status + ": " + message);
  });
`db.save` does not require an id for the document; if one doesn't exist it will get one from the server.
However, if the document does have an id it also requires a revision id.

### Execute a View
  // db.view(options);
  db.view({
    doc : "myDesignDocument",
    view : "foo",
    params : {
      startkey : "<KEY>",
      endkey : "<KEY>"
    },
    success : function (rows, response) {
      console.log("Retrieved Rows: " + rows);
    },
    error : function (status, message) {
      console.error(status + ": " + message);
    }
  });
 
### Execute a Show
  // db.show(options);
  db.show({
    doc : "myDesignDocument",
    show : "foo",
    id : "<KEY>",
    success : function (result) {
      document.getElementById("main").innerHTML = result;
    },
    error : function (status, message) {
      console.error(status + ": " + message);
    }
  });<commit_msg>Fixed README...again.<commit_after>SofaJS
======
SofaJS is a library that makes it easy to communicate with a CouchDB server from the front end.

Setup
-----
    Sofa.server = "http://mydomain.com/path/to/couchdb/";
Before you can use SofaJS you must set the server path to your CouchDB instance. It requires the trailing "/".

Server Status
-------------
    // Sofa.getStatus(success[, error]);
    Sofa.getStatus(function (response) {
      console.log(response.couchdb + " " + response.version);
    }, function (status, message) {
      console.error(status + ": " + message);
    });
 
Get UUIDs
---------
    // Sofa.getUUIDs(num, success[, error]);
    Sofa.getUUIDs(5, function (uuids) {
      for (var i = 0; i < 5; i++) {
        docs[i]._id = uuids[i];
      }
    }, function (status, message) {
      console.error(status + ": " + message);
    });
 
Database Replication
--------------------
    // Sofa.replicate(options);
    Sofa.replicate({
      source : "foo",
      target : "foo_backup",
      success : function (response) {
        console.log("Database Backed Up: " + response);
      },
      error : function (status, message) {
        console.error(status + ": " + message);
      }
    });
 
Database Binding
----------------
    // new Sofa.DB(name);
    var db = new Sofa.DB("foo");
Sofa.DB is the binding required to interact with a CouchDB Database.

### Create
    // db.create(success[, error]);
    db.create(function (response) {
      console.log("Database Created: " + response);
    }, function (status, message) {
      console.error(status + ": " + message);
    });
Create the database if it doesn't already exist.

### Delete
    // db.del(success[, error]);
    db.del(function (response) {
      console.log("Database Deleted: " + response);
    }, function (status, message) {
      console.error(status + ": " + message);
    });
Delete the database if it exists.

### Get a Document
    // db.get(id, success[, error]);
    db.get("<KEY>", function (doc) {
      console.log("Retrieved Document: " + doc);
    }, function (status, message) {
      console.log(status + ": " + message);
    });
 
### Save a Document
    // db.save(doc, success[, error]);
    db.save(doc, function (response) {
      console.log("Saved Document: " + response);
    }, function (status, message) {
      console.error(status + ": " + message);
    });
`db.save` does not require an id for the document; if one doesn't exist it will get one from the server.
However, if the document does have an id it also requires a revision id.

### Execute a View
    // db.view(options);
    db.view({
      doc : "myDesignDocument",
      view : "foo",
      params : {
        startkey : "<KEY>",
        endkey : "<KEY>"
      },
      success : function (rows, response) {
        console.log("Retrieved Rows: " + rows);
      },
      error : function (status, message) {
        console.error(status + ": " + message);
      }
    });
 
### Execute a Show
    // db.show(options);
    db.show({
      doc : "myDesignDocument",
      show : "foo",
      id : "<KEY>",
      success : function (result) {
        document.getElementById("main").innerHTML = result;
      },
      error : function (status, message) {
        console.error(status + ": " + message);
      }
    });
{'fraction_non_alphanumeric': 0.17603228810928284, 'fraction_numerical': 0.0009313877677739833, 'mean_word_length': 2.5207650273224043, 'pattern_counts': {'":': 18, '<': 13, '<?xml version=': 0, '>': 11, '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': '1148510', 'n_tokens_mistral': 2005, 'n_tokens_neox': 1976, 'n_words': 547}