searchPhoneNumbersInText.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports["default"] = searchPhoneNumbersInText;
  6. var _PhoneNumberMatcher = _interopRequireDefault(require("./PhoneNumberMatcher.js"));
  7. var _normalizeArguments2 = _interopRequireDefault(require("./normalizeArguments.js"));
  8. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  9. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  10. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  11. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  12. function searchPhoneNumbersInText() {
  13. var _normalizeArguments = (0, _normalizeArguments2["default"])(arguments),
  14. text = _normalizeArguments.text,
  15. options = _normalizeArguments.options,
  16. metadata = _normalizeArguments.metadata;
  17. var matcher = new _PhoneNumberMatcher["default"](text, _objectSpread(_objectSpread({}, options), {}, {
  18. v2: true
  19. }), metadata);
  20. return _defineProperty({}, Symbol.iterator, function () {
  21. return {
  22. next: function next() {
  23. if (matcher.hasNext()) {
  24. return {
  25. done: false,
  26. value: matcher.next()
  27. };
  28. }
  29. return {
  30. done: true
  31. };
  32. }
  33. };
  34. });
  35. }
  36. //# sourceMappingURL=searchPhoneNumbersInText.js.map