searchPhoneNumbersInText.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435
  1. 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; }
  2. 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; }
  3. 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; }
  4. import PhoneNumberMatcher from './PhoneNumberMatcher.js';
  5. import normalizeArguments from './normalizeArguments.js';
  6. export default function searchPhoneNumbersInText() {
  7. var _normalizeArguments = normalizeArguments(arguments),
  8. text = _normalizeArguments.text,
  9. options = _normalizeArguments.options,
  10. metadata = _normalizeArguments.metadata;
  11. var matcher = new PhoneNumberMatcher(text, _objectSpread(_objectSpread({}, options), {}, {
  12. v2: true
  13. }), metadata);
  14. return _defineProperty({}, Symbol.iterator, function () {
  15. return {
  16. next: function next() {
  17. if (matcher.hasNext()) {
  18. return {
  19. done: false,
  20. value: matcher.next()
  21. };
  22. }
  23. return {
  24. done: true
  25. };
  26. }
  27. };
  28. });
  29. }
  30. //# sourceMappingURL=searchPhoneNumbersInText.js.map