A string parser that determines if something is url-like
Want to see pretty graphs? Log in now!
npm install urlish
|7||downloads in the last day|
|45||downloads in the last week|
|140||downloads in the last month|
|Last Published By|
|Version||0.1.0 last updated 6 months ago|
This is a simple module that parses an input string to determine if it matches with a typical url syntax. This is not a strict URL parser, and if that behaviour is desired I would recommend looking at the core node url module.
This module was written to satisfy the use case of getit where url-like syntaxes are used.
So what is URLish?
In very simple terms we are looking for something that matches the following format:
At this stage, things like usernames and passwords are not looked at and no querystring or hash parsing is attempted either.
The following demonstrates the usage of
urlish within the context
ERROR: could not find:
In the case above, you will notice that the hostname component is not
automatically lowercased as it is using the
url.parse function. This is
useful when working with getit as we are using the host component to map
to a part of a real url that is case-sensitive.
Copyright (c) 2013 Damon Oehlman firstname.lastname@example.org
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.