Skip to content
This repository has been archived by the owner on Apr 23, 2023. It is now read-only.

Implements various Python functions and methods for use in Node

License

Notifications You must be signed in to change notification settings

wolfy1339/node-python-funcs

Repository files navigation

node-python-funcs

Implements various Python functions and methods for use in Node

Docs

Classes

str

Class to imitate Python str

dict

Class to imitate Python dicts

Functions

range([start], stop, [step])

Function to imitate Python's range function Returns an Array that produces a sequence of integers from start (inclusive) to stop (exclusive) by step.

len(thing) ⇒ `number`

Function to imitate Python's len() function. Wrapper function around the .length property

partition(string, sep) ⇒ `array`

Function to imitate Python's `str.partition()` method, since JavaScript can't split x times

split(string, sep, [maxCount]) ⇒ `array`

Function to imitate Python's `str.split()` method, since JavaScript can't split x times

chunks(l, n)

Yield successive n-sized chunks from l.

str

Class to imitate Python str

Kind: global class

new str(string)

Param Type
string string

str.partition() ⇐ partition

Kind: instance method of str Extends: partition

str.split() ⇐ split

Kind: instance method of str Extends: split

dict

Class to imitate Python dicts

Kind: global class

new dict(value)

Param Type Description
value object The native JavaScript object you wish to

dict.items() ⇒ array

Kind: instance method of dict

dict.clear()

Kind: instance method of dict

dict.get(key, [def]) ⇒ object | array | string | function | boolean | number

Kind: instance method of dict

Param Type Default
key string
[def] *

dict.pop(key, [def]) ⇒ *

Kind: instance method of dict

Param Type Default
key string
[def] *

dict.setdefault(key, [def]) ⇒ *

Kind: instance method of dict

Param Type Default
key string
[def] *

dict.keys() ⇒ array

Kind: instance method of dict

dict.update(other)

Kind: instance method of dict

Param Type
other object

dict.values() ⇒ array

Kind: instance method of dict

range([start], stop, [step])

Function to imitate Python's range function Returns an Array that produces a sequence of integers from start (inclusive) to stop (exclusive) by step.

Kind: global function

Param Type Default Description
[start] number The starting number. Defaults to 0.
stop number The end number.
[step] number 1 Specifies the increment (or decrement). Defaults to 1.

len(thing) ⇒ number

Function to imitate Python's len() function. Wrapper function around the .length property.

Kind: global function

Param Type
thing *

partition(string, sep) ⇒ array

Function to imitate Python's str.split() method, since JavaScript can't split x times

Kind: global function Returns: array - An Array containing the split string

Param Type Description
string string The string you want split.
sep string The seperator by which you want the string to be split

split(string, sep, [maxCount]) ⇒ array

Function to imitate Python's str.split method, since JavaScript can't split x times

Kind: global function Returns: array - An Array containing the split string

Param Type Default Description
string string The string you want split.
sep string The seperator by which you want the string to be split
[maxCount] number The maximum count of times you wish to split

chunks(l, n)

Yield successive n-sized chunks from l.

Kind: global function

Param Type
l array
n number

About

Implements various Python functions and methods for use in Node

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •