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

replace lodash depency in slate (#4245)

* replace lodash/omit with custom fn

* replace lodash/isEqual with fast-deep-equal
This commit is contained in:
Jonas Kruckenberg
2021-05-12 22:45:45 +02:00
committed by GitHub
parent 41af0584d2
commit b33a531bd0
4 changed files with 19 additions and 6 deletions

View File

@@ -16,11 +16,14 @@
"dependencies": {
"@types/esrever": "^0.2.0",
"esrever": "^0.2.0",
"fast-deep-equal": "^3.1.3",
"immer": "^8.0.1",
"is-plain-object": "^3.0.0",
"lodash": "^4.17.4",
"tiny-warning": "^1.0.3"
},
"devDependencies": {
"lodash": "^4.17.21"
},
"keywords": [
"canvas",
"contenteditable",

View File

@@ -1,6 +1,5 @@
import isPlainObject from 'is-plain-object'
import isEqual from 'lodash/isEqual'
import omit from 'lodash/omit'
import isEqual from 'fast-deep-equal'
import { Range } from '..'
import { ExtendedType } from './custom-types'
@@ -37,9 +36,15 @@ export const Text: TextInterface = {
): boolean {
const { loose = false } = options
function omitText(obj: Record<any, any>) {
const { text, ...rest } = obj
return rest
}
return isEqual(
loose ? omit(text, 'text') : text,
loose ? omit(another, 'text') : another
loose ? omitText(text) : text,
loose ? omitText(another) : another
)
},