a zip code crypto-currency system good for red ONLY

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*!
  2. * is-data-descriptor <https://github.com/jonschlinkert/is-data-descriptor>
  3. *
  4. * Copyright (c) 2015, Jon Schlinkert.
  5. * Licensed under the MIT License.
  6. */
  7. 'use strict';
  8. var typeOf = require('kind-of');
  9. // data descriptor properties
  10. var data = {
  11. configurable: 'boolean',
  12. enumerable: 'boolean',
  13. writable: 'boolean'
  14. };
  15. function isDataDescriptor(obj, prop) {
  16. if (typeOf(obj) !== 'object') {
  17. return false;
  18. }
  19. if (typeof prop === 'string') {
  20. var val = Object.getOwnPropertyDescriptor(obj, prop);
  21. return typeof val !== 'undefined';
  22. }
  23. if (!('value' in obj) && !('writable' in obj)) {
  24. return false;
  25. }
  26. for (var key in obj) {
  27. if (key === 'value') continue;
  28. if (!data.hasOwnProperty(key)) {
  29. continue;
  30. }
  31. if (typeOf(obj[key]) === data[key]) {
  32. continue;
  33. }
  34. if (typeof obj[key] !== 'undefined') {
  35. return false;
  36. }
  37. }
  38. return true;
  39. }
  40. /**
  41. * Expose `isDataDescriptor`
  42. */
  43. module.exports = isDataDescriptor;