Skip to content

Commit

Permalink
add badges for rubygems.org and main GH workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hmsk committed Jun 17, 2024
1 parent faea636 commit 33c3641
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

A Ruby wrapper for [QuickJS](https://bellard.org/quickjs) to run JavaScript codes via Ruby with a smaller footprint.

![Gem Version](https://img.shields.io/gem/v/quickjs?style=for-the-badge)
![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/hmsk/quickjs.rb/main?style=for-the-badge)


## Installation

```
Expand All @@ -21,10 +25,10 @@ require 'quickjs'

Quickjs.evalCode('const fn = (n, pow) => n ** pow; fn(2,8);') # => 256
Quickjs.evalCode('const fn = (name) => `Hi, ${name}!`; fn("Itadori");') # => "Hi, Itadori!
Quickjs.evalCode("const isOne = (n) => 1 === n; func(1);") #=> true (TruleClass)
Quickjs.evalCode("const isOne = (n) => 1 === n; func(1);") #=> true (TrueClass)
Quickjs.evalCode("const isOne = (n) => 1 === n; func(3);") #=> false (FalseClass)

# If the result returns 'object' for typeof, consumes it via JSON.stringify (JS) -> JSON.parse (Ruby)
# When code returns 'object' for `typeof`, the result is converted via JSON.stringify (JS) -> JSON.parse (Ruby)
Quickjs.evalCode("[1,2,3]") #=> [1, 2, 3] (Array)
Quickjs.evalCode("({ a: '1', b: 1 })") #=> { 'a' => '1', 'b' => 1 } (Hash)

Expand Down

0 comments on commit 33c3641

Please sign in to comment.