Git Product home page Git Product logo

se-expiry's Introduction

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

se-expiry's People

Contributors

devmaximilian avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.