mapfun
mapfunis a function that applies a mapping function to an infinite number of input elements, with options to skip certain elements and selectively apply the mapping to keys and/or values of objects.- The
mapfunfunction has been developed in JavaScript and Python, offering the same functionality in different programming languages.
Install
pip install mapfun
Import
from mapfun import mapfun
Arguments
fun: The mapping function that will be applied to each element in the input elements....X:The elements to be mapped .{ "skip" , "key" , "value" }: Object with three optional properties :"skip": specifies the elements to skip during the mapping process."key": boolean flag indicating whether to apply the mapping function to the keys of objects or not. The default value isfalse"value": boolean flag indicating whether to apply the mapping function to the values of objects or not. The default value istrue
Examples
print(mapfun(lambda a : a + 1,{},4))
# Expected return : 5
print(mapfun(lambda a : a + 1.0,{},4.2))
# Expected return : 5.2
print(mapfun(lambda a : len(a),{},"Ziko"))
# Expected return : 4
print(mapfun(lambda a : a + 5,{},[1, 2, 3, [4]]))
# Expected return : [6,7,8,[9]]
print(mapfun(lambda a : a + 5,range(0,10)))
print(mapfun(lambda a : a + 5,{},(1, 2, 3, [4])))
print(mapfun(lambda a : a + 5,{},{1,2,3}))
print(mapfun(lambda a : a + 5,frozenset({1,2,3})))
print(mapfun(lambda a : a + 5,{},{"a":1,"b":2,"c":3}))
print(mapfun(lambda x:x+1,{},1,2,3,[1,2]))
print(mapfun(lambda x:x+1,{},1,2,3,[1,2]))
Supported Datatypes
| Datatype | Support |
|---|---|
int |
✅ |
str |
✅ |
Boolean |
✅ |
float |
✅ |
None |
✅ |
memoryview |
✅ |
list |
✅ |
object |
✅ |
dict |
✅ |
set |
✅ |
tuple |
✅ |
bytes |
✅ |
bytearray |
✅ |
range |
✅ |
complex |
❌ |
Alternatives
Javascript
License
This projet is licensed under the terms of MIT License .
Metadata
Release files for mapfun 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mapfun-0.0.5.tar.gz | 3.3 kB | Without provenance | Details for mapfun-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mapfun-0.0.5-py3-none-any.whl | Python 3 | none | any | Details for mapfun-0.0.5-py3-none-any.whl |
Total release size: 6.9 kB
Release files / mapfun-0.0.5.tar.gz
| Download URL | mapfun-0.0.5.tar.gz |
|---|---|
| Size | 3.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
82a265e1dabf52e681531684b6858404d49d3477e8a4ba7fe97ea83c22f88cc3
|
|
BLAKE2b-256 checksum How to use checksums |
928a5aabfc00e74ca8638b5d701139ca98171983db99ba196f0cde11e9e4f159
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Release files / mapfun-0.0.5-py3-none-any.whl
| Download URL | mapfun-0.0.5-py3-none-any.whl |
|---|---|
| Size | 3.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d014dfece7ab243338c69b4ebe6cb8ae8353fce9f845a76fb611a4b784842d11
|
|
BLAKE2b-256 checksum How to use checksums |
e7e8e638670616313ac7f93f631352f160a394d47fc361fd24228f5eeb0579a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.12
|
Security for mapfun 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.