isnovid.a

0.2.1

npm install isnovid.a
4 downloads in the last week
16 downloads in the last month

isnovid.a

0.2.1

All methods take a lot of arguments. Each type is matched, depending on the function.

a.number 17, 1991 # true
a.string "isnovid", "a", "coffeescript", "javascript" # true

Many methods have aliases, made for beauty.

a.string "isnovid" # true
a.strings "a", "coffeescript", "javascript" # true

Install

Each version is published in the NPM repository.

npm install isnovid.a

git clone git://github.com/isnovid/isnovid.a.git

Interface

Server: A = require "isnovid.a"

Client: A = isnovid.A

a = new A

Does not accept arguments.

In the future it will be possible to accept the configuration.

Type checkers

a.null arguments...

a.null``a.nulls

a.nulls null, null, null # true
a.null 0 # false

a.undefined arguments...

a.undefined``a.undefineds

a.undefineds undefined, undefined, undefined # true

a.boolean arguments...

a.boolean``a.booleans

a.booleans true, false, true # true

a.number arguments...

a.number``a.numbers

a.numbers 17, 1991 # true
a.number NaN # false
a.number null # false

a.string arguments...

a.string``a.strings

a.strings "isnovid","a" # true

a.object arguments...

a.object``a.objects

a.objects {}, [], (->), /(\w+)\s(\w+)/ # true
a.object null # false
a.object undefined # false

a.array arguments...

a.array``a.arrays

a.arrays [], [1,2], [1..10] # true
a.array arguments # false
a.array {} # false

a.function arguments...

a.function``a.functions

a.functions ( -> ), class, -> # true
a.function new -> # false
a.function new class # false

a.arguments arguments...

a.arguments

a.arguments arguments # true
a.arguments {} # false
a.arguments [] # false

a.date arguments...

a.date,a.dates

a.date new Date # true

a.element arguments...

a.element``a.arguments

a.element document.getElementById('project') # true

a.finite arguments...

a.finite``a.finities

a.finite 17 # true
a.finite Infinity # false

a.nan arguments...

a.nan``a.NaN``a.Nan

a.nan NaN # true

a.reg arguments...

a.reg``a.regex``a.regexp``a.regExp``a.RegExp``a.regularExpression

a.reg /(\w+)\s(\w+)/ # true

a.empty arguments...

a.empty``a.empties

a.empties "", 0, [], {}, ->, null, undefined # true
a.empty [1..10] # false

a.equal arguments...

a.equal``a.equals

a.equal {name:"isnovid.a"},{name:"isnovid.a"},{name:"isnovid.a"} # true
a.equals (-> true),(-> true),(-> true) # true

a.of instances..., prototype

a.of``a.instanceof

With coffeescript classes.

B = class
b = new B
C = class extends B
c = new C
a.of c,b,B # true

With standart function prototype.

B = ->
b = new B
C = ->
C.prototype = b
c = new C
a.of c,b,B # true

Cycles

Sometimes you need to do a complex operation in the condition does not fit into a standard system of cycles. Also, loops embedded in the library used immediately logic conditions "and" and "or", which allows greatly simplify the code. Logical "or", executes the handler until until it returns true. Otherwise, the cycle will return false. Logical "or", executes the handler until until it returns true. Otherwise, the cycle will return false.

a.or counter, handler

a.or 4, (count) -> count is 2 # true

a.and counter, handler

a.and 4, (count) -> count < 2 # false

a.or container, handler

a.or { a: 1, b: 2 }, (value, key) -> a.number value # true

a.and container, handler

a.and { a: 1, b: 2 }, (value, key) -> a.number value  # true

a.or varibles..., handler

a.or a.string, a.number, (method) -> method "string" # true

a.and varibles..., handler

a.and [1..10]..., (value,key) -> a.number value # true

Contents

a.has container, keys...

a.has,a.key,a.keys

data =
    b: null
    c: undefined
    d: true

a.keys data,"b","c","d" # true
a.keys data,"b","c","f" # false
npm loves you