Skip to content

Instantly share code, notes, and snippets.

View pguillory's full-sized avatar

Preston Guillory pguillory

  • Pinterest
  • San Francisco
View GitHub Profile
// foo.js
console.log('foo');
require('bar').print();
//bar.js
exports.print = function() {
console.log('bar');
}
/**
* Copyright (c) 2011 Bruno Jouhier <bruno.jouhier@sage.com>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
f1(function(err) {
console.log(err);
});
function f1(callback) {
// throw new Error("You can catch me.");
f2(function(err) {
if (err) return callback(err);
function create(record, callback) {
var table = record._table
try {
var fields = prepareFields(record, table, { _version: 1 })
} catch (err) {
return callback(err)
}
checkKeys(table, record, function(err) {
function create_(record) {
var table = record._table
try {
var fields = prepareFields(record, table, { _version: 1 })
} catch (err) {
throw err
}
checkKeys_(table, record)