https://github.com/zakarialaoui10/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 origin of this function traces back to zikojs
https://github.com/zakarialaoui10/mapfun
awesome data function javascript map php python
Last synced: 3 months ago
JSON representation
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 origin of this function traces back to zikojs
- Host: GitHub
- URL: https://github.com/zakarialaoui10/mapfun
- Owner: zakarialaoui10
- License: mit
- Created: 2023-03-21T18:55:37.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2026-03-01T12:15:08.000Z (3 months ago)
- Last Synced: 2026-03-01T14:05:58.145Z (3 months ago)
- Topics: awesome, data, function, javascript, map, php, python
- Language: JavaScript
- Homepage:
- Size: 535 KB
- Stars: 39
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
|Langage|Problem|Solution|
|-|-|-|
|Javascript|||
|Python|||
The magic function called `mapfun`
# 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.
- [Javascript](https://github.com/zakarialaoui10/mapfun/tree/main/Javascript#readme)
* [NPM](https://www.npmjs.com/package/mapfun)
- [Python](https://github.com/zakarialaoui10/mapfun/tree/main/Python#readme)
* [PyPI](https://pypi.org/project/mapfun/)
# Syntax
|Javascript|Python|
|-|-|
|`mapfun(callback,{},...args)`|`mapfun(callback,{},*args)`|
# Install
|Javascript|Python|
|-|-|
|`npm i mapfun`|`pip install mapfun`|
### Arguments
- `fun` : The mapping function that will be applied to each element in the input elements.
- `...X` for javascripters or`*X` for pythonista :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 is `false`
* `value` : boolean flag indicating whether to apply the mapping function to the values of objects or not. The default value is `true`
# Supported Datatypes
|Javascript|Support|Python|Support|
|---|-|---|-|
|`Number`|✅|`int`|✅|
|`String`|✅|`str`|✅|
|`Boolean`|✅|`Boolean`|✅|
|`Null`|✅|`float`|✅|
|`NaN`|✅|`None`|✅|
|`Undefined`|✅|`memoryview`|✅|
|`BigInt`|✅|`complex`|❌|
|`Array`|✅|`list`|✅|
|`Object`|✅|`object`|✅|
|`Map`|✅|`dict`|✅|
|`Set`|✅|`set`|✅|
|`WeakMap`|❌|`tuple`|✅|
|`WeakSet`|❌|`bytes`|✅|
|`ArrayBuffer`|✅|`bytearray`|✅|
|`Symbol`|❌|`range`|✅|
# Stats
|NPM|PYPI|
|-|-|
|||
|||
|||
# License
This projet is licensed under the terms of MIT License .