Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function (url, opts) {
performance.mark(url + " - begin")
const { fetch } = abortableFetch(nodeFetch) as any
return fetch(url, opts).then(_ => {
performance.mark(url + " - end")
const measure = () => performance.measure(_.url, url + " - begin", url + " - end")
performance.clearMarks(url + " - begin")
if(timeout)
setTimeout(measure, timeout)
else
measure()
return _
})
}
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* helper functions related to interacting with chainpoint network objects
* such as nodes and cores
*/
import { resolveTxt } from 'dns'
import { parse } from 'url'
import { promisify } from 'util'
import { isInteger, isFunction, isEmpty, slice, map, shuffle, filter, first, isString } from 'lodash'
import { isURL, isIP } from 'validator'
const { AbortController, abortableFetch } = require('abortcontroller-polyfill/dist/cjs-ponyfill')
const { fetch } = abortableFetch(require('node-fetch'))
import getConfig from '../config'
import { DNS_CORE_DISCOVERY_ADDR } from '../constants'
import { testArrayArg } from './helpers'
let config = getConfig()
/**
* Check if valid Core URI
*
* @param {string} coreURI - The Core URI to test for validity
* @returns {bool} true if coreURI is a valid Core URI, otherwise false
*/
export function isValidCoreURI(coreURI) {
if (isEmpty(coreURI) || !isString(coreURI)) return false