UNPKG

simple-dynamo

Version:

Abstraction of Amazons Dynamo DB Service. Usage of AWS DynamoDB incredible simple.

65 lines (63 loc) 2.1 kB
// Generated by CoffeeScript 1.10.0 (function() { module.exports = { extend: function() { var clone, copy, deep, i, isArray, isPlainObject, length, name, options, src, target; target = arguments[0] || {}; i = 1; length = arguments.length; deep = false; if (typeof target === "boolean") { deep = target; target = arguments[1] || {}; i = 2; } if (typeof target !== "object" && !typeof target === "function") { target = {}; } isArray = function(obj) { if (toString.call(copy) === "[object Array]") { return true; } else { return false; } }; isPlainObject = function(obj) { var has_is_property_of_method, has_own_constructor, key, last_key; if (!obj || toString.call(obj) !== "[object Object]" || obj.nodeType || obj.setInterval) { return false; } has_own_constructor = hasOwnProperty.call(obj, "constructor"); has_is_property_of_method = hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf"); if (obj.constructor && !has_own_constructor && !has_is_property_of_method) { return false; } for (key in obj) { last_key = key; } return typeof last_key === "undefined" || hasOwnProperty.call(obj, last_key); }; while (i < length) { if ((options = arguments[i]) !== null) { for (name in options) { src = target[name]; copy = options[name]; if (target === copy) { continue; } if (deep && copy && (isPlainObject(copy) || isArray(copy))) { clone = (src && (isPlainObject(src) || isArray(src)) ? src : (isArray(copy) ? [] : {})); target[name] = utils.extend(deep, clone, copy); } else { if (typeof copy !== "undefined") { target[name] = copy; } } } } i++; } return target; } }; }).call(this);