argsArgArrayOrObject.js 908 B

1234567891011121314151617181920212223242526
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.argsArgArrayOrObject = void 0;
  4. var isArray = Array.isArray;
  5. var getPrototypeOf = Object.getPrototypeOf, objectProto = Object.prototype, getKeys = Object.keys;
  6. function argsArgArrayOrObject(args) {
  7. if (args.length === 1) {
  8. var first_1 = args[0];
  9. if (isArray(first_1)) {
  10. return { args: first_1, keys: null };
  11. }
  12. if (isPOJO(first_1)) {
  13. var keys = getKeys(first_1);
  14. return {
  15. args: keys.map(function (key) { return first_1[key]; }),
  16. keys: keys,
  17. };
  18. }
  19. }
  20. return { args: args, keys: null };
  21. }
  22. exports.argsArgArrayOrObject = argsArgArrayOrObject;
  23. function isPOJO(obj) {
  24. return obj && typeof obj === 'object' && getPrototypeOf(obj) === objectProto;
  25. }
  26. //# sourceMappingURL=argsArgArrayOrObject.js.map