1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-08-30 18:39:51 +02:00

Optimize isText, isElement, isNodeList and isEditor (#5859)

* Remove the `isPlainObject` check from `isText` and `isElement` for performance

* Optimise `isElement`, `isNodeList` and `isText` further

* Update changeset

* Fix changeset

* Refactor object check into `isObject`
This commit is contained in:
Joe Anderson
2025-05-05 16:31:56 +01:00
committed by GitHub
parent d39bead80a
commit 72532fd2d7
20 changed files with 112 additions and 86 deletions

View File

@@ -13,9 +13,6 @@
"files": [
"dist/"
],
"dependencies": {
"is-plain-object": "^5.0.0"
},
"devDependencies": {
"@babel/runtime": "^7.23.2",
"lodash": "^4.17.21",

View File

@@ -1,5 +1,4 @@
import { isPlainObject } from 'is-plain-object'
import { Operation, Range } from 'slate'
import { Operation, Range, isObject } from 'slate'
interface Batch {
operations: Operation[]
@@ -24,7 +23,7 @@ export const History = {
isHistory(value: any): value is History {
return (
isPlainObject(value) &&
isObject(value) &&
Array.isArray(value.redos) &&
Array.isArray(value.undos) &&
(value.redos.length === 0 ||