findPhoneNumbersInText.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports["default"] = findPhoneNumbersInText;
  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 findPhoneNumbersInText() {
  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. var results = [];
  21. while (matcher.hasNext()) {
  22. results.push(matcher.next());
  23. }
  24. return results;
  25. }
  26. //# sourceMappingURL=findPhoneNumbersInText.js.map