1.3.1 • Published 6 years ago

arkin v1.3.1

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

Arkin

Just ideas that popped into my head.

npm

NPM GitHub

Features

Installation

To install, open your command line and navigate to your project folder. Then run:

npm install arkin

At the top of your program add:

const arkin = require('arkin');

Reference

Sleep

Information

Pauses the program for a short time.

Parameters

  • milliseconds: The amount of time in milliseconds to wait.

Usage

arkin.sleep(1000);

Pauses for 1000 milliseconds or 1 second.

End

Information

Ends the program with exit code 0.

Parameters

None

Usage

arkin.end()

Ends the program with exit code 0.

Error

Information

Ends the program with exit code 1 and logs the error.

Parameters

  • ERR: The error that happened.

Usage

var err = "Uh Oh";
arkin.error(err);

Outputs in the console:

There was an error:
Uh Oh

Ends the program with exit code 1.

Clear

Information

Clears the console.

Parameters

None

Usage

arkin.clear();

Clears the console.

List

Information

Takes an array and makes a list from it.

Parameters

  • list: An array containing the messages to be displayed.
  • config: Optional A JSON object which determines the starting number and marker.
    • startingNumber: Optional An integer which determines the first number of the list. Default: '1'.
    • marker: Optional A string which decides what separates the number and the message. Default: '.'.

Usage

const list = ["Yo", "hi", "hello"]

const config = {
  startingNumber: 1,
  marker: ')'
};

arkin.list(list, config);

Outputs in the console:

1) Yo
2) hi
3) hello

GetDate

Information

Gets the current date in any format.

Parameters

  • config: Optional A JSON object which determines the information and the way it is returned.
    • format: Optional Determines all of the formatting for the date.
      • order: Optional A string which specifies the order of the day, month, and year. Separated by hyphens. Default 'month-day-year'.
      • extraZero: Optional A boolean which while true, adds an extra zero to the beginning of both the day and month if it is less then ten. Default: 'true'.
      • year: Optional A string which determines the length of the year by the amount of 'y's in it. Removes numbers from the left. Default: 'yyyy'.
      • separator: Optional A string which determines the separator between the day, month, and year. Default: '/'.

Usage

Example date is February 23rd, 2064

  const config = {
    format: {
      order: 'year-month-day',
      extraZero: false,
      year: 'yyy',
      separator: ','
    }
  };

  var date = arkin.getDate(config);
  console.log(date);

Outputs in the console:

064,2,23

ToBoolean

Information

Returns a boolean value from a string or returns a float or returns a number

Parameters

  • boolIn: A string which contains the value to be returned
  • toInteger: Optional A boolean value which specifies weather or not to return a float

Usage

console.log(typeof arkin.toBool('true'), false);

Outputs in the console:

boolean
1.3.1

6 years ago

1.3.0

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.3

6 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago