🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@metascraper/helpers

Package Overview
Dependencies
Maintainers
1
Versions
251
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

to
3.3.0

README.md

19

index.js

@@ -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": {