INNER CODE UNIT · JavaScript

UrlWhitelist

opentimestamps/javascript-opentimestamps · src/calendar.js:118

class UrlWhitelist {
  constructor (urls) {
    this.urls = new Set()
    if (!urls) {
      return
    }
    urls.forEach(u => this.add(u))
  }

  add (url) {
    if (typeof (url) !== 'string') {
      throw new TypeError('URL must be a string')
    }
    if (url.startsWith('http://') || url.startsWith('https://')) {
      this.urls.add(url)
    } else {
      this.urls.add('http://' + url)
      this.urls.add('https://' + url)

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…