0.1.0 • Published 7 years ago
@dogmalang/reminder v0.1.0
@dogmalang/reminder
A reminder implementation.
Developed in Dogma, compiled to JavaScript.
Engineered in Valencia, Spain, EU by Justo Labs.
Use
The package must be imported as follows:
////////////////
// JavaScript //
////////////////
import Reminder from "@dogmalang/reminder";
#########
# Dogma #
#########
use "@dogmalang/reminder" as ReminderConstructor
////////////////
// JavaScript //
////////////////
constructor(items:array, opts:{max:number})
constructor(opts:{max:number})
#########
# Dogma #
#########
type Reminder(items:list, opts:{max:num})
type Reminder(opts:{max:num})items, the initial items.opts, the options:max, maximum number of items to remind.
Examples:
////////////////
// JavaScript //
////////////////
r = new Reminder({max: 123})
#########
# Dogma #
#########
r = Queue({max=123})append() and push()
Add a new item at the end of the reminder:
////////////////
// JavaScript //
////////////////
append(item) : Reminder
push(item) : Reminder
#########
# Dogma #
#########
@alias("append")
fn Reminder.push(item) -> selfThe method returns the queue for chaining other appends. If the reminder has the maximum number of items to remind, the oldest is removed for generating gap to the new one.
Example:
r.push("one").push("two").push("three")pop()
Remove the latest item and returning it:
////////////////
// JavaScript //
////////////////
pop() : any
#########
# Dogma #
#########
fn Reminder.pop() : anyIf the reminder is empty, an error is raised.
Example:
i = r.pop()len
Return the current length:
////////////////
// JavaScript //
////////////////
len : number
#########
# Dogma #
#########
fn Reminder.len : numExample:
size = r.lenmax
Return the maximum size:
////////////////
// JavaScript //
////////////////
max : number
#########
# Dogma #
#########
@prop
fn Reminder.max() : numisEmpty()
Check whether the reminder is empty:
////////////////
// JavaScript //
////////////////
isEmpty() : boolean
#########
# Dogma #
#########
fn Reminder.isEmpty() : boolExample:
r.isEmpty()isFull()
Check whether the reminder is full:
////////////////
// JavaScript //
////////////////
isFull() : boolean
#########
# Dogma #
#########
fn Reminder.isFull() : boollist()
Return a list with the reminded items:
////////////////
// JavaScript //
////////////////
list() : any[]
#########
# Dogma #
#########
fn Reminder.list() : listExample:
r.list()0.1.0
7 years ago