# pybuiltinfunc

> Python built-in Functions and Modules in Javascript

Latest version **1.2.0** (published 2022-02-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install pybuiltinfunc
pnpm add pybuiltinfunc
yarn add pybuiltinfunc
bun add pybuiltinfunc
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2022-02-12 |
| First published | 2021-11-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 21.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ajay The Wizard |
| Maintainers | ajaythewizard |
| Keywords | Pyjs, Python, Python Built-in Functions, Python Built-in Loops, Python Loops in, Python Built-in Modules, Python OS Module, Python Math Module, Math, Python List |

## Links

- npm: https://www.npmjs.com/package/pybuiltinfunc
- npm.io page: https://npm.io/package/pybuiltinfunc

## Alternatives

- [random-seedable](https://npm.io/package/random-seedable.md) — 27.9K weekly downloads
- [n2words](https://npm.io/package/n2words.md) — 22.2K weekly downloads
- [@stdlib/math-base-special-factorialln](https://npm.io/package/@stdlib/math-base-special-factorialln.md) — 5.7K weekly downloads
- [@stdlib/math-base-special-abs2](https://npm.io/package/@stdlib/math-base-special-abs2.md) — 1.7K weekly downloads
- [commons-math-interpolation](https://npm.io/package/commons-math-interpolation.md) — 1.4K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2022-02-12
- 1.1.9 — 2022-01-30
- 1.1.8 — 2021-12-28
- 1.1.7 — 2021-12-27
- 1.1.6 — 2021-12-27
- 1.1.5 — 2021-12-26
- 1.1.4 — 2021-12-25
- 1.1.3 — 2021-12-25
- 1.1.2 — 2021-12-24
- 1.1.1 — 2021-12-24
- 1.1.0 — 2021-12-24
- 1.0.9 — 2021-12-24
- 1.0.8 — 2021-12-23
- 1.0.7 — 2021-12-22
- 1.0.6 — 2021-12-22
- … 6 more at https://npm.io/package/pybuiltinfunc/versions

## README

# `Python Built-in Functions`

## `What's new in 1.2.0`
+ Added new Python `Str` Type with 39 methods.

## `What's new in 1.1.9`
+ Added new module `json`.

## `Why I made this`

I loves both Python and Javascript.
Then I found that Python Built-in Functions is easier than Javascript.At first, I made this for my personal purpose.
Then I decided to publish in both yarn and npm. If you have any idea about add new Built-in Function or Any Bugs, Kindly Contact me through my email.

```
abhiajay0206@gmail.com
```

## `Installing`

```
// For npm
npm i pybuiltinfunc
// or
// For yarn
yarn add pybuiltinfunc
```

## `Importing`

```
// ES5
const { /* Some Functions */ } = require('pybuiltinfunc');

// ES6+
import { /* Some Functions */ } from 'pybuiltinfunc';
```

## `Available Functions`

You can find these uses with example [here](https://www.w3schools.com/python/python_ref_functions.asp)

- `abs()`
- `all()`
- `chr()`
- `str()`
- `int()`
- `float()`
- `ord()`
- `len()`
- `bin()`
- `print()`
- `min()`
- `map()`
- `sum()`
- `range()`
- `type()`

### `Examples`

```
import { print } from "pybuiltinfunc";

print("Hello")
```

```
import { print, len } from "pybuiltinfunc";

print(len("Some Text"))
```

## `Available Built-in Modules`

- `math`
  - `sqrt()`
  - `acos()`
  - `acosh()`
  - `asin()`
  - `asinh()`
  - `atan()`
  - `atan2()`
  - `atanh()`
  - `ceil()`
  - `comb()`
  - `factorial()`
  - `cbrt()`
  - `copysign()`
  - `cos()`
  - `cosh()`
  - `degrees()`
  - `dist()`
  - `exp()`
  - `expm1()`
  - `floor()`
  - `fmod()`
  - `gcd()`
  - `hypot()`
  - `sin()`
  - `sinh()`
  - `tan()`
  - `tanh()`
  - `pow()`
  - `prod()`
  - `isfinite()`
  - `isinf()`
  - `isprt()`
  - `radians()`
  - `isnan()`
  - `perm()`
  - `nan`
  - `e`
  - `pi`
  - `log`
  - `log2`
  - `log10`
  - `log1p`
  - `tau`
- `random`
  - `randint()`
  - `uniform()`
- `os`
  - `getcwd()`
  - `chdir()`
  - `mkdir()`
  - `rmdir()`
  - `remove()`
  - `listdir()`
  - `rename()`
  - `name()`
  - `path [ os.path ]`
    - `join()`
- `json`
  - `load()`
  - `dumps()`

### Examples

```
import { print, math } from "pybuiltinfunc";

print(math.sqrt(16))

```

```
import { print, random } from "pybuiltinfunc";

print(random.randint(0, 4))

```
## `Python List`
List in Python and Array in Javascript are same. But, Those who learn Python as first language (like me) would find Python List is easy. So I made this. You can import `List` class by, 
```
import { List } from "pybuiltinfunc";

```

Using it is little bit difference,
```
const list = new List([5, 7, 8, 9])
list.append(7)
print(list.return())
```
In Above code, You can find `list.return()`. It is used to return value.

### `Available Method:`
- `append()`
- `insert()`
- `extend()`
- `remove()`
- `pop()`
- `insert()`
- `clear()`
- `reverse()`
- `count()`
- `copy()`

## `Python String`
Yeah Python String is also available in this Package. Usage is same as `List`.

### `Example`
```
import { Str, print } from "pybuiltinfunc";

const string = new Str("Hello World!")
print(string.return())
print(string.casefold())
```

## `Available Methods`
- `capitalize()`
- `casefold()`
- `center()`
- `count()`
- `endswith()`
- `expandtabs()`
- `find()`
- `index()`
- `isalnum()`
- `isalpha()`
- `isdecimal()`
- `isidentifier()`
- `isprintable()`
- `isdigit()`
- `islower()`
- `isspace()`
- `istitle()`
- `isupper()`
- `join()`
- `ljust()`
- `lower()`
- `lstrip()`
- `partition()`
- `replace()`
- `rfind()`
- `rindex()`
- `rjust()`
- `rpartition()`
- `rsplit()`
- `rstrip()`
- `split()`
- `splitlines()`
- `startswith()`
- `strip()`
- `swapcase()`
- `title()`
- `translate()`
- `upper()`
- `zfill()`

## `Python Loops`

Python loops in Javascript is seems like insane idea. Let me tell What's difference is You can use `==` instead of `===`, use `!=` instead of `!==`, use `and` instead of `&&` and `or` instead of `||` .

`loop` is a object which you can import using ,

```
import { loop } from 'pybuiltinfunc';
```

Then using it is super simple and available method are `if` and `ifElse`.
Here some examples below ,

### `If Loop`

```
loop.if("5<6", ()=>{
    // some code...
})
```
After v1.1.8, You can no longer use other than string as first parameter.
First Parameter is condition and Second Parameter is an Anonymous Function.

### `If and Else Loop`

```
loop.if("5<6", ()=>{
    // some code runs if true
}, ()=>{
  // some code runs if false
})
```

First Parameter is condition, Second Parameter is an Anonymous Function for `If` condition and Third Parameter is also an Anonymous Function for `Else` condition.

### `My Email`

```
abhiajay0206@gmail.com
```

---
_Source: https://npm.io/package/pybuiltinfunc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
