nyinaa 0.0.5

A collection of reusable functions & utilities (timers, validators, sanitizers, ranges, logging, ...)


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

Nyinaa

A collection of reusable functions & utilities (timers, validators, sanitizers, ranges, logging, ...)

Installation

To install this package from the Dub package repository, you may add nyinaa as dependency in your dub.json file and the package will be downloaded automatically during project build if it's not downloaded already.

{
    "dependencies": {
        "nyinaa": "~>0.0.3"
    }
}

You may also fetch the latest version manually in the command-line:

dub add nyinaa

Example

import nyinaa.timers : setInterval, stopInterval;

import std.stdio : writeln;
import std.datetime : seconds;
import core.thread.osthread : Thread;

void main()
{
	// "tid" of type Tid can be referenced
	// to stop setInterval()
	auto tid = setInterval(1000.seconds, { writeln("tick"); });
	auto tid2 = setInterval(3000.seconds, { writeln("tock"); });
	Thread.sleep(12.seconds);

	// stop running setInterval()
	stopInterval(tid);
	stopInterval(tid2);

	// OR keep running timers
	// using import core.thread.osthread: thread_joinAll;
    // thread_joinAll();
}

Implemented functions - Validators

Validators - for user data (e.g. form data)

  • [x] isEmail()
  • [x] isIP()
  • [x] isIPv4()
  • [x] isIPv6()
  • [x] isUUID()
  • [x] isUUIDv3()
  • [x] isUUIDv4()
  • [x] isUUIDv5()

Implemented functions - Timers

Time-based utility functions

  • [x] setInterval()
  • [x] stopInterval()

Implemented functions - Sanitizers

Sanitizing data

  • [x] stripTags()

Implemented functions - Image

Image related operation

  • [x] isImageDataURI()
  • [x] bufferFromDataURI()

Implemented functions - Range

Handy functions for use in range related tasks

  • [x] concreteRange()
  • [x] orElse()
  • [x] then()

Documentation

See the documentation for the various functions and examples on how to use them.

To-do

Any generic validator form validation, etc. is welcomed

Authors:
  • Lawrence Aberba
Dependencies:
none
Versions:
0.0.5 2021-Jan-18
0.0.4 2020-Jul-30
0.0.3 2020-Jul-25
0.0.2 2020-Jul-25
0.0.1 2020-Jul-25
Show all 6 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 2 downloads total

Score:
0.6
Short URL:
nyinaa.dub.pm