Name | mapfun JSON |
Version |
0.0.5
JSON |
| download |
home_page | |
Summary | mapfun |
upload_time | 2023-05-24 16:01:06 |
maintainer | |
docs_url | None |
author | Zakaria Elalaoui |
requires_python | |
license | |
keywords |
zikojs
python
map
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# mapfun
- `mapfun` is 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 `mapfun` function has been developed in JavaScript and Python, offering the same functionality in different programming languages.
### Install
```bash
pip install mapfun
```
### Import
```bash
from mapfun import mapfun
```
### Arguments
- `fun` : The mapping function that will be applied to each element in the input elements.</br>
- `...X` :The elements to be mapped . </br>
- `{ "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 is `false`
* `"value"` : boolean flag indicating whether to apply the mapping function to the values of objects or not. The default value is `true`
### Examples
```python
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](https://github.com/zakarialaoui10/mapfun/blob/main/Javascript/README.md)
# License
This projet is licensed under the terms of MIT License .<br>
<img src="https://img.shields.io/github/license/zakarialaoui10/zikojs?color=rgb%2820%2C21%2C169%29">
Raw data
{
"_id": null,
"home_page": "",
"name": "mapfun",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "zikojs,python,map",
"author": "Zakaria Elalaoui",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/92/8a/5aabfc00e74ca8638b5d701139ca98171983db99ba196f0cde11e9e4f159/mapfun-0.0.5.tar.gz",
"platform": null,
"description": "# mapfun\n- `mapfun` is 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.\n- The `mapfun` function has been developed in JavaScript and Python, offering the same functionality in different programming languages.\n### Install \n```bash\npip install mapfun\n```\n### Import \n```bash\nfrom mapfun import mapfun\n```\n### Arguments\n- `fun` : The mapping function that will be applied to each element in the input elements.</br>\n- `...X` :The elements to be mapped . </br>\n- `{ \"skip\" , \"key\" , \"value\" }` : Object with three optional properties :\n * `\"skip\"` : specifies the elements to skip during the mapping process.\n * `\"key\"` : boolean flag indicating whether to apply the mapping function to the keys of objects or not. The default value is `false`\n * `\"value\"` : boolean flag indicating whether to apply the mapping function to the values of objects or not. The default value is `true`\n### Examples \n```python\nprint(mapfun(lambda a : a + 1,{},4))\n# Expected return : 5\nprint(mapfun(lambda a : a + 1.0,{},4.2))\n# Expected return : 5.2\nprint(mapfun(lambda a : len(a),{},\"Ziko\"))\n# Expected return : 4\nprint(mapfun(lambda a : a + 5,{},[1, 2, 3, [4]]))\n# Expected return : [6,7,8,[9]]\nprint(mapfun(lambda a : a + 5,range(0,10)))\nprint(mapfun(lambda a : a + 5,{},(1, 2, 3, [4])))\nprint(mapfun(lambda a : a + 5,{},{1,2,3}))\nprint(mapfun(lambda a : a + 5,frozenset({1,2,3})))\nprint(mapfun(lambda a : a + 5,{},{\"a\":1,\"b\":2,\"c\":3}))\nprint(mapfun(lambda x:x+1,{},1,2,3,[1,2]))\nprint(mapfun(lambda x:x+1,{},1,2,3,[1,2]))\n```\n# Supported Datatypes\n|Datatype|Support|\n|---|-|\n|`int`|\u2705|\n|`str`|\u2705|\n|`Boolean`|\u2705|\n|`float`|\u2705|\n|`None`|\u2705|\n|`memoryview`|\u2705|\n|`list`|\u2705|\n|`object`|\u2705|\n|`dict`|\u2705|\n|`set`|\u2705|\n|`tuple`|\u2705|\n|`bytes`|\u2705|\n|`bytearray`|\u2705|\n|`range`|\u2705|\n|`complex`|\u274c|\n\n# Alternatives\n## [Javascript](https://github.com/zakarialaoui10/mapfun/blob/main/Javascript/README.md)\n# License \nThis projet is licensed under the terms of MIT License .<br>\n<img src=\"https://img.shields.io/github/license/zakarialaoui10/zikojs?color=rgb%2820%2C21%2C169%29\">\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "mapfun",
"version": "0.0.5",
"project_urls": null,
"split_keywords": [
"zikojs",
"python",
"map"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e7e8e638670616313ac7f93f631352f160a394d47fc361fd24228f5eeb0579a3",
"md5": "9349f6cf0ed4fc2ad0fff40c35a029b9",
"sha256": "d014dfece7ab243338c69b4ebe6cb8ae8353fce9f845a76fb611a4b784842d11"
},
"downloads": -1,
"filename": "mapfun-0.0.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9349f6cf0ed4fc2ad0fff40c35a029b9",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3601,
"upload_time": "2023-05-24T16:01:04",
"upload_time_iso_8601": "2023-05-24T16:01:04.889904Z",
"url": "https://files.pythonhosted.org/packages/e7/e8/e638670616313ac7f93f631352f160a394d47fc361fd24228f5eeb0579a3/mapfun-0.0.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "928a5aabfc00e74ca8638b5d701139ca98171983db99ba196f0cde11e9e4f159",
"md5": "7347ca3bdfe94c8dee9ca813676207c9",
"sha256": "82a265e1dabf52e681531684b6858404d49d3477e8a4ba7fe97ea83c22f88cc3"
},
"downloads": -1,
"filename": "mapfun-0.0.5.tar.gz",
"has_sig": false,
"md5_digest": "7347ca3bdfe94c8dee9ca813676207c9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3324,
"upload_time": "2023-05-24T16:01:06",
"upload_time_iso_8601": "2023-05-24T16:01:06.748093Z",
"url": "https://files.pythonhosted.org/packages/92/8a/5aabfc00e74ca8638b5d701139ca98171983db99ba196f0cde11e9e4f159/mapfun-0.0.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-24 16:01:06",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "mapfun"
}