se-expiry

0.2.0 • Public • Published

SE Expiry

A simple wrapper to get the list of .se domains expiring soon. Built with Promises in mind.

Data fetched from Internetstiftelsen.

Example usage

Simple usage example

const expiry = require('se-expiry');
 
expiry
  .load()
  .then(domains => {
    // Do something
  })
  .catch(error => {
    // Handle error
  });

Manual usage example

const expiry = require('se-expiry');
 
expiry
  .fetch()
  .then(data => {
    expiry
      .parse(data)
      .then(domains => {
        // Do something
      })
      .catch(error => {
        // Handle parse error
      });
  })
  .catch(error => {
    // Handle fetch error
  });

Documentation

Any functions/methods prefixed with an underscore are not intended to be called manually.

Class: Domain

class Domain {
 
  // Class constructor
  constructor(:name = String, :expires = Date)
 
}

Class: Domains (collection)

class Domains {
 
  // Class constructor
  constructor(:items = [Domain])
 
  // Sorting function (sorts by date)
  _byDate(:a = Domain, :b = Domain) // => Bool
 
  // Sorting function (sorts by name length)
  _byLength(:a = Domain, :b = Domain) // => Bool
 
  // Sort interface (called by order method)
  _sort(:by = Function) // => Promise
 
  // Order method (by accepts 'date' or 'length', fallback is 'date')
  order(:by = String) // => Promise
}

Function: fetch

// Fetch function (https fallback is true)
fetch(:https = Bool) // => Promise

Function: parse

// Parse function (https fallback is true)
fetch(:raw = String) // => Promise

Package Sidebar

Install

npm i se-expiry

Weekly Downloads

1

Version

0.2.0

License

MIT

Unpacked Size

7.8 kB

Total Files

9

Last publish

Collaborators

  • devmaximilian