Skip to content

Commit

Permalink
Remove Array.flatMap polyfill
Browse files Browse the repository at this point in the history
This has been supported natively since Node v11, Chrome 69, Firefox 62
and Safari 12.
  • Loading branch information
robertknight committed Apr 13, 2022
1 parent d68857d commit 81d3272
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
4 changes: 1 addition & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@
"test-cjs": "yarn build-cjs && nyc mocha -r build-cjs/test/init.js build-cjs/test/*.js",
"test:compat": "yarn test --preact-compat-lib preact/compat"
},
"dependencies": {
"array.prototype.flatmap": "^1.2.1"
},
"dependencies": {},
"files": [
"build/src/**/*",
"build-cjs/src/**/*",
Expand Down
3 changes: 1 addition & 2 deletions src/preact10-rst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

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

import { childElements } from './compat.js';
import {
Expand Down Expand Up @@ -47,7 +46,7 @@ function rstNodesFromChildren(nodes: (VNode | null)[] | null): RSTNodeTypes[] {
if (!nodes) {
return [];
}
return flatMap(nodes, (node: VNode | null) => {
return nodes.flatMap(node => {
if (node === null) {
// The array of rendered children may have `null` entries as a result of
// eg. conditionally rendered children where the condition was false.
Expand Down
9 changes: 0 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -451,15 +451,6 @@ array.prototype.flat@^1.2.3:
define-properties "^1.1.3"
es-abstract "^1.17.0-next.1"

array.prototype.flatmap@^1.2.1:
version "1.2.3"
resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.2.3.tgz#1c13f84a178566042dd63de4414440db9222e443"
integrity sha512-OOEk+lkePcg+ODXIpvuU9PAryCikCJyo7GlDG1upleEpQRx6mzL9puEBkozQ5iAx20KV0l3DbyQwqciJtqe5Pg==
dependencies:
define-properties "^1.1.3"
es-abstract "^1.17.0-next.1"
function-bind "^1.1.1"

asn1@~0.2.3:
version "0.2.4"
resolved "https://registry.yarnpkg.com/asn1/-/asn1-0.2.4.tgz#8d2475dfab553bb33e77b54e59e880bb8ce23136"
Expand Down

0 comments on commit 81d3272

Please sign in to comment.