caffeine-script-runtime
Runtime library for CaffeineScript
Last updated a year ago by shanebdavis .
ISC · Original npm · Tarball · package.json
$ cnpm install caffeine-script-runtime 
SYNC missed versions from official npm registry.

caffeine-script-runtime Build Status

Runtime module required by CaffeineScript.com

Future?

Operator overloading and ruby-truth support

# CaffeineStyle truth (same as Ruby)

returns true if a is anothing other than false, null or undefined
isTrue: isTrue = (a) -> a? && a != false

returns true if a is false, null or undefined
isFalse: isFalse = (a) -> a == false || !a?

gt:     (a, b) -> if typeof a == "number" and typeof b == "number" then a > b else a.gt b
lt:     (a, b) -> if typeof a == "number" and typeof b == "number" then a < b else a.lt b
lte:    (a, b) -> if typeof a == "number" and typeof b == "number" then a <= b else a.lte b
gte:    (a, b) -> if typeof a == "number" and typeof b == "number" then a >= b else a.gte b

add:    (a, b) -> if (typeof  a == "number" and typeof b == "number") || (typeof a == "string" and typeof b == "string") then a + b else a.add b
sub:    (a, b) -> if typeof   a == "number" and typeof b == "number" then a - b else a.sub b
mul:    (a, b) -> if typeof   a == "number" and typeof b == "number" then a * b else a.mul b
div:    (a, b) -> if typeof   a == "number" and typeof b == "number" then a / b else a.div b

Current Tags

  • 1.13.3                                ...           latest (a year ago)

18 Versions

  • 1.13.3                                ...           a year ago
  • 1.12.0                                ...           a year ago
  • 1.10.0                                ...           2 years ago
  • 1.7.2                                ...           2 years ago
  • 1.7.1                                ...           2 years ago
  • 1.6.0                                ...           2 years ago
  • 1.4.2                                ...           2 years ago
  • 1.3.1                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
  • 1.1.8                                ...           3 years ago
  • 1.1.7                                ...           3 years ago
  • 1.1.6                                ...           3 years ago
  • 1.1.5                                ...           3 years ago
  • 1.1.1                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
  • 0.2.3                                ...           3 years ago
  • 0.2.2                                ...           3 years ago

Copyright 2014 - 2016 © taobao.org |