[
  {
    "path": ".gitignore",
    "content": "node_modules\ncomponents\nbuild"
  },
  {
    "path": ".travis.yml",
    "content": "language: node_js\nnode_js:\n  - 8"
  },
  {
    "path": "History.md",
    "content": "\n1.2.0 - November 25, 2014\n-------------------------\n* add support for protocol relative urls\n\n1.1.0 - February 8, 2013\n------------------------\n* support any protocol\n* support paths on localhost\n\n1.0.0 - January 17, 2013\n------------------------\n* allow localhost to have a port\n\n0.1.0 - September 8, 2013\n-------------------------\n* make regexp match more valid url types\n\n0.0.2 - August 2, 2013\n----------------------\n* remove loose matching\n\n0.0.1 - August 2, 2013\n----------------------\n:sparkles:"
  },
  {
    "path": "LICENSE-MIT",
    "content": "MIT LICENSE\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  {
    "path": "Readme.md",
    "content": "# is-url\n\n> **Note**  \n> Segment has paused maintenance on this project, but may return it to an active status in the future. Issues and pull requests from external contributors are not being considered, although internal contributions may appear from time to time. The project remains available under its open source license for anyone to use.\n\nCheck whether a string is a URL.\n\n## Installation\n\n```sh\nnpm install is-url\n```\n\n## API\n\n### `isUrl(string)`\n\nReturns a Boolean indicating whether `string` is a URL.\n\n## License\n\nMIT\n"
  },
  {
    "path": "index.js",
    "content": "\n/**\n * Expose `isUrl`.\n */\n\nmodule.exports = isUrl;\n\n/**\n * RegExps.\n * A URL must match #1 and then at least one of #2/#3.\n * Use two levels of REs to avoid REDOS.\n */\n\nvar protocolAndDomainRE = /^(?:\\w+:)?\\/\\/(\\S+)$/;\n\nvar localhostDomainRE = /^localhost[\\:?\\d]*(?:[^\\:?\\d]\\S*)?$/\nvar nonLocalhostDomainRE = /^[^\\s\\.]+\\.\\S{2,}$/;\n\n/**\n * Loosely validate a URL `string`.\n *\n * @param {String} string\n * @return {Boolean}\n */\n\nfunction isUrl(string){\n  if (typeof string !== 'string') {\n    return false;\n  }\n\n  var match = string.match(protocolAndDomainRE);\n  if (!match) {\n    return false;\n  }\n\n  var everythingAfterProtocol = match[1];\n  if (!everythingAfterProtocol) {\n    return false;\n  }\n\n  if (localhostDomainRE.test(everythingAfterProtocol) ||\n      nonLocalhostDomainRE.test(everythingAfterProtocol)) {\n    return true;\n  }\n\n  return false;\n}\n"
  },
  {
    "path": "package.json",
    "content": "{\n  \"name\": \"is-url\",\n  \"description\": \"Check whether a string is a URL.\",\n  \"repository\": \"https://github.com/segmentio/is-url\",\n  \"version\": \"1.2.4\",\n  \"scripts\": {\n    \"test\": \"mocha --reporter spec\"\n  },\n  \"license\": \"MIT\",\n  \"devDependencies\": {\n    \"mocha\": \"*\"\n  }\n}\n"
  },
  {
    "path": "test/index.js",
    "content": "\ntry {\n  var url = require('is-url');\n} catch (e) {\n  var url = require('..');\n}\n\nvar assert = require('assert');\n\ndescribe('is-url', function () {\n  describe('valid', function () {\n    it('http://google.com', function () {\n      assert(url('http://google.com'));\n    });\n\n    it('https://google.com', function () {\n      assert(url('https://google.com'));\n    });\n\n    it('ftp://google.com', function () {\n      assert(url('ftp://google.com'));\n    });\n\n    it('http://www.google.com', function () {\n      assert(url('http://www.google.com'));\n    });\n\n    it('http://google.com/something', function () {\n      assert(url('http://google.com/something'));\n    });\n\n    it('http://google.com?q=query', function () {\n      assert(url('http://google.com?q=query'));\n    });\n\n    it('http://google.com#hash', function () {\n      assert(url('http://google.com#hash'));\n    });\n\n    it('http://google.com/something?q=query#hash', function () {\n      assert(url('http://google.com/something?q=query#hash'));\n    });\n\n    it('http://google.co.uk', function () {\n      assert(url('http://google.co.uk'));\n    });\n\n    it('http://www.google.co.uk', function () {\n      assert(url('http://www.google.co.uk'));\n    });\n\n    it('http://google.cat', function () {\n      assert(url('http://google.cat'));\n    });\n\n    it('https://d1f4470da51b49289906b3d6cbd65074@app.getsentry.com/13176', function () {\n      assert(url('https://d1f4470da51b49289906b3d6cbd65074@app.getsentry.com/13176'));\n    });\n\n    it('http://0.0.0.0', function () {\n      assert(url('http://0.0.0.0'));\n    });\n\n    it('http://localhost', function () {\n      assert(url('http://localhost'));\n    });\n\n    it('postgres://u:p@example.com:5702/db', function () {\n      assert(url('postgres://u:p@example.com:5702/db'));\n    });\n\n    it('redis://:123@174.129.42.52:13271', function () {\n      assert(url('redis://:123@174.129.42.52:13271'));\n    });\n\n    it('mongodb://u:p@example.com:10064/db', function () {\n      assert(url('mongodb://u:p@example.com:10064/db'));\n    });\n\n    it('ws://chat.example.com/games', function () {\n      assert(url('ws://chat.example.com/games'));\n    });\n\n    it('wss://secure.example.com/biz', function () {\n      assert(url('wss://secure.example.com/biz'));\n    });\n\n    it('http://localhost:4000', function () {\n      assert(url('http://localhost:4000'));\n    });\n\n    it('http://localhost:342/a/path', function () {\n      assert(url('http://localhost:342/a/path'));\n    });\n\n    it('//google.com', function () {\n      assert(url('//google.com'));\n    });\n  });\n\n  describe('invalid', function () {\n    it('http://', function () {\n      assert(!url('http://'));\n    });\n\n    it('http://google', function () {\n      assert(!url('http://google'));\n    });\n\n    it('http://google.', function () {\n      assert(!url('http://google.'));\n    });\n\n    it('google', function () {\n      assert(!url('google'));\n    });\n\n    it('google.com', function () {\n      assert(!url('google.com'));\n    });\n\n    it('empty', function () {\n      assert(!url(''));\n    });\n\n    it('undef', function () {\n      assert(!url(undefined));\n    });\n\n    it('object', function () {\n      assert(!url({}));\n    });\n\n    it('re', function () {\n      assert(!url(/abc/));\n    });\n  });\n\n  describe('redos', function () {\n    it('redos exploit', function () {\n      // Invalid. This should be discovered in under 1 second.\n      var attackString = 'a://localhost' + '9'.repeat(100000) + '\\t';\n      var before = process.hrtime();\n      assert(!url(attackString), 'attackString was valid');\n      var elapsed = process.hrtime(before);\n      assert(elapsed[0] < 1, 'attackString took ' + elapsed[0] + ' > 1 seconds');\n    });\n  });\n});\n"
  }
]