pynodejs
v1.0.0
Published
Python core inside JavaScript
Downloads
3
Maintainers
Readme
PyNodeJS
Dear AWESOME users,
First, I have to say this module is not a complete Python language inside JavaScript(DUH), instead this module is some core build in function I think is useful Python have :P
@felixfong227
Basic output
# Python
print ("Howdy y'all")
// JavaScript
const pynodejs = require('pynodejs')
pynodejs.print("Howdy y'all")
List
# Python
splitString = list('This is a string')
// JavaScript
const pynodejs = require('pynodejs')
const splitString = pynodejs.list('This is a string')
Read file
# Python
fo = open('textfile.txt', 'r')
fileContent = fo.read()
// JavaScript
const pynodejs = require('pynodejs')
const fileContent = pynodejs.read('textfile.txt')
Write file
# Python
fo = open('textfile.txt', 'w')
fo.write('pony!')
// JavaScript
const pynodejs = require('pynodejs')
pynodejs.write('textfile.txt', 'pony!')
Typing checking
# Python
isStringRight = isinstance('String', 'char');
// JavaScript
const pynodejs = require('pynodejs')
pynodejs.isinstance('String', 'char')
Length
# Python
stringLength = len('This is a string')
// JavaScript
const pynodejs = require('pynodejs')
const stringLength = pynodejs.len('This is a string')
Round
# Python
rounded = round(3.14)
// JavaScript
const pynodejs = require('pynodejs')
const rounded = pynodejs.round(3.14)
MD5
# Python
m = md5.new()
m.update("Howdy")
m.hax()
// JavaScript
const pynodejs = require('pynodejs')
const encrypttion = pynodejs.encrypt.md5('Howdy')
SHA224
# Python
m = md5.new()
m.update("Howdy")
m.hax()
// JavaScript
const pynodejs = require('pynodejs')
const encrypttion = pynodejs.encrypt.sha224('Howdy')