Skip to content

Instantly share code, notes, and snippets.

View imbcmdth's full-sized avatar

Jon-Carlos Rivera imbcmdth

View GitHub Profile
@cowboy
cowboy / call-invo-cursion.js
Last active March 30, 2023 01:59
JavaScript: call invo-cursion?
// OOP
console.log( 'OHAI'.blink() );
// Call invocation
console.log( String.prototype.blink.call('OHAI') );
// $ always makes things look awesome.
var $ = Function.prototype.call;
// Very explicit call invocation
@imbcmdth
imbcmdth / deepCopy.js
Created September 12, 2012 19:47
Robust deep copying of objects w/ support for cycles
var deepCopy = (function () {
var funcBlacklist = ['caller', 'arguments', 'prototype' ],
primitiveCloner = makeCloner(clonePrimitive),
cloneFunctions = {
'[object Null]': primitiveCloner,
'[object Undefined]': primitiveCloner,
'[object Number]': primitiveCloner,
'[object String]': primitiveCloner,
'[object Boolean]': primitiveCloner,
'[object RegExp]': makeCloner(cloneRegExp),