Launch Week Day 5: Introducing Reachability for PHP.Learn More
Socket
Book a DemoSign in
Socket

@metascraper/helpers

Package Overview
Dependencies
Maintainers
1
Versions
265
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metascraper/helpers - npm Package Compare versions

Comparing version
3.2.0
to
3.3.0
+19
README.md
# metascraper-helpers
[![npm](https://img.shields.io/npm/v/metascraper-helpers.svg?style=flat-square)](https://www.npmjs.com/package/metascraper-helpers)
[![Dependency Status](https://david-dm.org/microlinkhq/metascraper.svg?path=packages/metascraper-helpers&style=flat-square)](https://david-dm.org/microlinkhq/metascraper?path=packages/metascraper-helpers)
> Collection of helper functions used by metascraper.
## Install
```bash
$ npm install @metascraper/helpers --save
```
## License
**metascraper-helpers** © [microlink.io](https://microlink.io), Released under the [MIT](https://github.com/microlinkhq/metascraper-helpers/blob/master/LICENSE.md) License.<br>
Authored and maintained by microlink.io with help from [contributors](https://github.com/microlinkhq/metascraper-helpers/contributors).
> [microlink.io](https://microlink.io) · GitHub [@microlink.io](https://github.com/microlinkhq) · Twitter [@microlinkhq](https://twitter.com/microlinkhq)
+14
-5

@@ -8,14 +8,23 @@ 'use strict'

const smartquotes = require('smartquotes')
const { flow, isNil } = require('lodash')
const toTitle = require('to-title-case')
const urlRegex = require('url-regex')
const { flow } = require('lodash')
const isUrl = value => urlRegex().test(value)
const isUrl = (url, {relative = true} = {}) => {
if (isNil(url)) return false
if (!relative) return urlRegex().test(url)
return isRelativeUrl(url) || urlRegex().test(url)
}
const normalizeUrl = url => sanetizeUrl(url, { stripWWW: false })
const getAbsoluteUrl = (url, baseUrl) =>
isRelativeUrl(url) ? resolveUrl(baseUrl, url) : url
const getAbsoluteUrl = (baseUrl, relativePath = '') => (
isRelativeUrl(relativePath)
? resolveUrl(baseUrl, relativePath)
: relativePath
)
const getUrl = (url, baseUrl) => normalizeUrl(getAbsoluteUrl(url, baseUrl))
const getUrl = (baseUrl, relativePath) => (
normalizeUrl(getAbsoluteUrl(baseUrl, relativePath))
)

@@ -22,0 +31,0 @@ const createTitle = flow([condenseWhitespace, smartquotes])

@@ -5,3 +5,3 @@ {

"homepage": "https://metascraper.js.org",
"version": "3.2.0",
"version": "3.3.0",
"main": "src/index.js",

@@ -8,0 +8,0 @@ "author": {

# Change Log
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
<a name="3.2.0"></a>
# [3.2.0](https://github.com/microlinkhq/metascraper/tree/master/packages/metascraper-helpers/compare/v3.1.0...v3.2.0) (2017-12-19)
**Note:** Version bump only for package @metascraper/helpers