Comparing version 0.4.8 to 0.5.1
@@ -0,1 +1,21 @@ | ||
<a name="0.5.1"></a> | ||
## [0.5.1](https://github.com/ipfs/is-ipfs/compare/v0.5.0...v0.5.1) (2019-02-11) | ||
<a name="0.5.0"></a> | ||
# [0.5.0](https://github.com/ipfs/is-ipfs/compare/v0.4.8...v0.5.0) (2019-02-11) | ||
### Bug Fixes | ||
* double validate ([#25](https://github.com/ipfs/is-ipfs/issues/25)) ([8f8616f](https://github.com/ipfs/is-ipfs/commit/8f8616f)) | ||
### Features | ||
* add cidPath function ([7be55d3](https://github.com/ipfs/is-ipfs/commit/7be55d3)) | ||
<a name="0.4.8"></a> | ||
@@ -2,0 +22,0 @@ ## [0.4.8](https://github.com/ipfs/is-ipfs/compare/v0.4.7...v0.4.8) (2018-11-23) |
{ | ||
"name": "is-ipfs", | ||
"version": "0.4.8", | ||
"version": "0.5.1", | ||
"description": "A set of utilities to help identify IPFS resources", | ||
@@ -5,0 +5,0 @@ "leadMaintainer": "Marcin Rataj <lidel@lidel.org>", |
@@ -81,2 +81,8 @@ is-ipfs | ||
isIPFS.cidPath('QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o/path/to/file') // true | ||
isIPFS.cidPath('QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o/') // true | ||
isIPFS.cidPath('QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o') // false | ||
isIPFS.cidPath('/ipfs/QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o') // false | ||
isIPFS.cidPath('/ipfs/QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o/file') // false | ||
isIPFS.subdomain('http://bafybeie5gq4jxvzmsym6hjlwxej4rwdoxt7wadqvmmwbqi7r27fclha2va.ipfs.dweb.link') // true | ||
@@ -83,0 +89,0 @@ isIPFS.subdomain('http://bafybeiabc2xofh6tdi6vutusorpumwcikw3hf3st4ecjugo6j52f6xwc6q.ipns.dweb.link') // true |
@@ -38,3 +38,4 @@ 'use strict' | ||
try { | ||
return CID.isCID(new CID(hash)) | ||
new CID(hash) // eslint-disable-line no-new | ||
return true | ||
} catch (e) { | ||
@@ -98,2 +99,6 @@ return false | ||
function isString (input) { | ||
return typeof input === 'string' | ||
} | ||
function convertToString (input) { | ||
@@ -104,3 +109,3 @@ if (Buffer.isBuffer(input)) { | ||
if (typeof input === 'string') { | ||
if (isString(input)) { | ||
return input | ||
@@ -131,3 +136,4 @@ } | ||
pathPattern: pathPattern, | ||
urlOrPath: (x) => (isIpfs(x, urlPattern) || isIpns(x, urlPattern) || isIpfs(x, pathPattern) || isIpns(x, pathPattern)) | ||
urlOrPath: (x) => (isIpfs(x, urlPattern) || isIpns(x, urlPattern) || isIpfs(x, pathPattern) || isIpns(x, pathPattern)), | ||
cidPath: path => isString(path) && !isCID(path) && isIpfs(`/ipfs/${path}`, pathPattern) | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
757829
381
179