Skip to content

Instantly share code, notes, and snippets.

@wryk
Last active August 29, 2015 13:58
Show Gist options
  • Select an option

  • Save wryk/10274768 to your computer and use it in GitHub Desktop.

Select an option

Save wryk/10274768 to your computer and use it in GitHub Desktop.
module.exports = Something;
function Something () {}
Something.prototype.toJSON = function () {
var clone = {};
var firstChar;
var that = this;
Object.keys(this).forEach(function (key) {
var firstChar = key[0];
if (firstChar !== '_' && firstChar !== '$') {
clone[key] = that[key];
}
});
return clone;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment