Skip to content

Commit 81d3272

Browse files
committed
Remove Array.flatMap polyfill
This has been supported natively since Node v11, Chrome 69, Firefox 62 and Safari 12.
1 parent d68857d commit 81d3272

File tree

3 files changed

+2
-14
lines changed

3 files changed

+2
-14
lines changed

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@
4343
"test-cjs": "yarn build-cjs && nyc mocha -r build-cjs/test/init.js build-cjs/test/*.js",
4444
"test:compat": "yarn test --preact-compat-lib preact/compat"
4545
},
46-
"dependencies": {
47-
"array.prototype.flatmap": "^1.2.1"
48-
},
46+
"dependencies": {},
4947
"files": [
5048
"build/src/**/*",
5149
"build-cjs/src/**/*",

src/preact10-rst.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import type { NodeType, RSTNode } from 'enzyme';
1212
import { Component, Fragment, VNode } from 'preact';
13-
import flatMap from 'array.prototype.flatmap';
1413

1514
import { childElements } from './compat.js';
1615
import {
@@ -47,7 +46,7 @@ function rstNodesFromChildren(nodes: (VNode | null)[] | null): RSTNodeTypes[] {
4746
if (!nodes) {
4847
return [];
4948
}
50-
return flatMap(nodes, (node: VNode | null) => {
49+
return nodes.flatMap(node => {
5150
if (node === null) {
5251
// The array of rendered children may have `null` entries as a result of
5352
// eg. conditionally rendered children where the condition was false.

yarn.lock

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -451,15 +451,6 @@ array.prototype.flat@^1.2.3:
451451
define-properties "^1.1.3"
452452
es-abstract "^1.17.0-next.1"
453453

454-
array.prototype.flatmap@^1.2.1:
455-
version "1.2.3"
456-
resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.2.3.tgz#1c13f84a178566042dd63de4414440db9222e443"
457-
integrity sha512-OOEk+lkePcg+ODXIpvuU9PAryCikCJyo7GlDG1upleEpQRx6mzL9puEBkozQ5iAx20KV0l3DbyQwqciJtqe5Pg==
458-
dependencies:
459-
define-properties "^1.1.3"
460-
es-abstract "^1.17.0-next.1"
461-
function-bind "^1.1.1"
462-
463454
asn1@~0.2.3:
464455
version "0.2.4"
465456
resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136"

0 commit comments

Comments
 (0)