New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@dogmalang/stack

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dogmalang/stack

A stack implementation.

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

@dogmalang/stack

NPM version Total downloads

A stack implementation.

Developed in Dogma, compiled to JavaScript.

Engineered in Valencia, Spain, EU by Justo Labs.

Use

The package must be imported as follows:

////////////////
// JavaScript //
////////////////
const Stack = require("@dogmalang/stack");

#########
# Dogma #
#########
use "@dogmalang/stack" as Stack

Constructor

////////////////
// JavaScript //
////////////////
constructor()
constructor(items:any[])
constructor(opts:{max:number})

#########
# Dogma #
#########
type Stack()
type Stack(items:list)
type Stack(opts:{max:num})
  • items, the initial items.
  • opts, the options: max, maximum number of items.

Examples:

////////////////
// JavaScript //
////////////////
s = new Stack()
s = new Stack(["one", "two", "three"])
s = new Stack({max: 123})

#########
# Dogma #
#########
s = Stack()
s = Stack(["one", "two", "three"])
s = Stack({max=123})

push() and append()

Add a new item to the stack:

////////////////
// JavaScript //
////////////////
push(item) : Stack

#########
# Dogma #
#########
fn Stack.push(item) -> self

The method returns the stack for chaining other pushes. If the stack has max and this reached, an error is raised.

Example:

s.push("one").push("two").push("three")

pop()

Remove the top item and returning it:

////////////////
// JavaScript //
////////////////
pop() : any

#########
# Dogma #
#########
fn Stack.pop() : any

If the stack is empty, an error is raised.

Example:

i = s.pop()

len()

Return the current length:

////////////////
// JavaScript //
////////////////
len() : number

#########
# Dogma #
#########
fn Stack.len() : num

Example:

size = s.len()

isEmpty()

Check whether the stack is empty:

////////////////
// JavaScript //
////////////////
isEmpty() : boolean

#########
# Dogma #
#########
fn Stack.isEmpty() : bool

Example:

s.isEmpty()

top()

Return the top item without removing it:

////////////////
// JavaScript //
////////////////
top() : any

#########
# Dogma #
#########
fn Stack.top() : any

Example:

s.push("one").push("two").top()

list()

Return a list with the items:

////////////////
// JavaScript //
////////////////
list() : any[]

#########
# Dogma #
#########
fn Stack.list() : list

Example:

s.list()

Keywords

Dogma

FAQs

Package last updated on 03 Feb 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts