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
4.9.0

25

index.js

@@ -29,2 +29,3 @@ 'use strict'

const toTitle = require('title')
const isUri = require('is-uri')
const { URL } = require('url')

@@ -69,4 +70,6 @@ const urlLib = require('url')

const absoluteUrl = (baseUrl, relativePath = '') =>
resolveUrl(baseUrl, relativePath)
const absoluteUrl = (baseUrl, relativePath) => {
if (isEmpty(relativePath)) return baseUrl
return resolveUrl(baseUrl, relativePath)
}

@@ -81,4 +84,5 @@ const sanetizeUrl = (url, opts) =>

const normalizeUrl = (baseUrl, relativePath, opts) =>
sanetizeUrl(absoluteUrl(baseUrl, relativePath), opts)
const normalizeUrl = (baseUrl, relativePath, opts) => {
return sanetizeUrl(absoluteUrl(baseUrl, relativePath), opts)
}

@@ -149,6 +153,11 @@ const removeByPrefix = flow([value => value.replace(REGEX_BY, ''), trim])

const url = (value, { url }) => {
if (isEmpty(value)) return false
const absoluteUrl = normalizeUrl(url, value)
return isUrl(absoluteUrl) && absoluteUrl
const url = (value, { url = '' } = {}) => {
if (isEmpty(value)) return null
try {
const absoluteUrl = normalizeUrl(url, value)
if (isUrl(absoluteUrl)) return absoluteUrl
} catch (err) {}
return isUri(value) ? value : null
}

@@ -155,0 +164,0 @@

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

"homepage": "https://metascraper.js.org",
"version": "4.8.5",
"version": "4.9.0",
"main": "index.js",

@@ -26,2 +26,3 @@ "repository": {

"is-relative-url": "~2.0.0",
"is-uri": "~1.2.0",
"iso-639-3": "~1.1.0",

@@ -59,3 +60,3 @@ "isostring": "0.0.1",

},
"gitHead": "068b68d820b2e85643e0137481a30f027d4ec771"
"gitHead": "ca32573e15b3305a83c94806560200674ec7d4b5"
}
SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.