An open API service indexing awesome lists of open source software.

https://github.com/codewithswastik/javascript-py

This package lets you use Javascript like objects in python
https://github.com/codewithswastik/javascript-py

javascript python

Last synced: 11 months ago
JSON representation

This package lets you use Javascript like objects in python

Awesome Lists containing this project

README

          

# Javascript.py

This package lets you use javascript like objects in python.

## Installation

Stable version:

```
pip install javascriptpy
```

Working version:

```
pip install git+https://github.com/CodeWithSwastik/javascript-py
```

## Example Usage

```python
from javascript import *

array = Array('apple', 'orange', 'cherry')
index = Math.floor(Math.random() * array.length)

console.info('Random element:', array[index])
console.table(array)
```

## Console

```py
from javascript import console, Array

console.clear()
console.error("Syntax Error!")
console.warn("Forgot an import!")
console.table(Array(['earth', 'venus']))
```

![image](https://user-images.githubusercontent.com/61446939/126521684-669e4dd5-4263-4c5e-9cce-9c0e097759e3.png)

## What's new?

- Added RegExp, Date, JSON