1.0.7 • Published 3 months ago

array.prototype.map v1.0.7

Weekly downloads
2,304,231
License
MIT
Repository
github
Last release
3 months ago

array.prototype.map Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES5 spec-compliant Array.prototype.map shim/polyfill/replacement that works as far down as ES3.

This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec.

Because Array.prototype.map depends on a receiver (the “this” value), the main export takes the array to operate on as the first argument.

Example

var map = require('array.prototype.map');
var assert = require('assert');

assert.deepEqual(map([1, 1, 1], function (x) { return x + 1; }), [2, 2, 2]);
assert.deepEqual(map([1, 0, 1], function (x) { return x + 1; }), [2, 1, 2]);
var map = require('array.prototype.map');
var assert = require('assert');
/* when Array#map is not present */
delete Array.prototype.map;
var shimmedMap = map.shim();
assert.equal(shimmedMap, map.getPolyfill());
var arr = [1, 2, 3];
var add4 = function (x) { return x + 4; };
assert.deepEqual(arr.map(add4), map(arr, add4));
var map = require('array.prototype.map');
var assert = require('assert');
/* when Array#map is present */
var shimmedMap = map.shim();
assert.equal(shimmedMap, Array.prototype.map);
assert.deepEqual(arr.map(add4), map(arr, add4));

Tests

Simply clone the repo, npm install, and run npm test

promise.allsettledeasy-select-rnreact-native-printer-brothersreact-native-shekhar-bridge-test@oiti/documentoscopy-react-nativequoc-test@saaspe/componentsluminos-ui-core@everything-registry/sub-chunk-1165jawwy-sdkjawwy_gamification_releasereact-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkgreact-native-jawwy_samplegoogle-remakegriffin-ui-librarykhaled-salem-custom-componentshong1-utilsjordy-frijters-test-libjrennsoh88-react-native-scroll-indicatornew-awesome-4321native-date-picker-modulenative-modal-damage-vehicle@react-native-ui-design/button@valifysolutions/react-native-vidvliveness@praella/localisationist@podlubnaja/ui-kit@thinxviewx/core-rn@supernpm2024/laudantium-delectus-ipsam-sit@taingo97/react-native-awesome-module@taingo97/react-native-bluetooth-xprinter@taingo97/react-native-expo-key-rsa-kt@taingo97/react-native-expo-rsa@taingo97/react-native-generate-key-rsa@taingo97/react-native-key-rsa@taingo97/react-native-print-xprinter@taingo97/react-native-rsa@taingo97/react-native-rsa-expo@taingo97/react-native-sunmi-printer@taingo97/react-native-telpo-printer@sidghimire/react-native-mapbox-navigation@sephriot/react-native-persistable-uri@skeetboothppq/component-library@shivarajapple/first-library@status-im/react-native-transparent-video@vitali_shcherbina/styled-libwifi_configuration_packagezeo-collectyangtao-jsjawwy_library_newjawy_library_v1gamification-jawwy-libraryframework_test_library_sixdee_new_jawwytest_lib_module_aarquickcapture_react_nativeproject-wajs-dvpromise.anypixiu-swap-corepixiuswap-libs-sdkpnm-yph-react-native-custom-componentsparvan_reactjs_componentsparvan_componentstest-haptik-libtest-library-123test-zeo-collectsvelte-component-libreact-form-component-libraryreact-native-get-countriesreact-native-ghn-ekycreact-native-innity-2react-native-innity-remasterreact-native-create-video-thumbnailreact-native-cplusreact-native-input-libraryreact-native-basic-screenreact-native-check-componentreact-native-auth-service-clientreact-native-aventonfacetec-aventonreact-native-awesome-android-123react-native-awesome-android-123-zeotapreact-native-badge-controlreact-native-android-video-player-viewreact-native-basic-appreact-native-arps-authorize-netreact-native-animate-textreact-native-awesome-module-latestreact-native-awesome-module-tworeact-native-azure-communication-servicesreact-native-bridge-packagereact-native-build-vesion-getterreact-native-bubble-chartreact-native-app-integrity-checksumreact-native-app-bubblereact-native-bleccs-componentsreact-native-bluetooth-device-detectreact-native-chenaarreact-native-conekta-card-tokenizerreact-native-ctp-odp
1.0.7

3 months ago

1.0.6

9 months ago

1.0.5

2 years ago

1.0.4

3 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

5 years ago

1.0.0

5 years ago