Socket
Socket
Sign inDemoInstall

caffeine-script-runtime

Package Overview
Dependencies
0
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    caffeine-script-runtime

Runtime library for CaffeineScript


Version published
Weekly downloads
1.1K
decreased by-13.98%
Maintainers
1
Install size
81.1 kB
Created
Weekly downloads
 

Readme

Source

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

FAQs

Last updated on 28 Oct 2020

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc