Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

Utility.js 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Generated by CoffeeScript 1.12.7
  2. (function() {
  3. var assign, isArray, isEmpty, isFunction, isObject, isPlainObject,
  4. slice = [].slice,
  5. hasProp = {}.hasOwnProperty;
  6. assign = function() {
  7. var i, key, len, source, sources, target;
  8. target = arguments[0], sources = 2 <= arguments.length ? slice.call(arguments, 1) : [];
  9. if (isFunction(Object.assign)) {
  10. Object.assign.apply(null, arguments);
  11. } else {
  12. for (i = 0, len = sources.length; i < len; i++) {
  13. source = sources[i];
  14. if (source != null) {
  15. for (key in source) {
  16. if (!hasProp.call(source, key)) continue;
  17. target[key] = source[key];
  18. }
  19. }
  20. }
  21. }
  22. return target;
  23. };
  24. isFunction = function(val) {
  25. return !!val && Object.prototype.toString.call(val) === '[object Function]';
  26. };
  27. isObject = function(val) {
  28. var ref;
  29. return !!val && ((ref = typeof val) === 'function' || ref === 'object');
  30. };
  31. isArray = function(val) {
  32. if (isFunction(Array.isArray)) {
  33. return Array.isArray(val);
  34. } else {
  35. return Object.prototype.toString.call(val) === '[object Array]';
  36. }
  37. };
  38. isEmpty = function(val) {
  39. var key;
  40. if (isArray(val)) {
  41. return !val.length;
  42. } else {
  43. for (key in val) {
  44. if (!hasProp.call(val, key)) continue;
  45. return false;
  46. }
  47. return true;
  48. }
  49. };
  50. isPlainObject = function(val) {
  51. var ctor, proto;
  52. return isObject(val) && (proto = Object.getPrototypeOf(val)) && (ctor = proto.constructor) && (typeof ctor === 'function') && (ctor instanceof ctor) && (Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object));
  53. };
  54. module.exports.assign = assign;
  55. module.exports.isFunction = isFunction;
  56. module.exports.isObject = isObject;
  57. module.exports.isArray = isArray;
  58. module.exports.isEmpty = isEmpty;
  59. module.exports.isPlainObject = isPlainObject;
  60. }).call(this);