mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-10 17:24:02 +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:
committed by
GitHub
parent
41af0584d2
commit
b33a531bd0
5
.changeset/red-bears-cry.md
Normal file
5
.changeset/red-bears-cry.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'slate': patch
|
||||
---
|
||||
|
||||
Removed lodash dependecy to reduce bundled footprint
|
@@ -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",
|
||||
|
@@ -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
|
||||
)
|
||||
},
|
||||
|
||||
|
@@ -5656,7 +5656,7 @@ faker@^4.1.0:
|
||||
resolved "https://registry.yarnpkg.com/faker/-/faker-4.1.0.tgz#1e45bbbecc6774b3c195fad2835109c6d748cc3f"
|
||||
integrity sha1-HkW7vsxndLPBlfrSg1EJxtdIzD8=
|
||||
|
||||
fast-deep-equal@^3.1.1:
|
||||
fast-deep-equal@^3.1.1, fast-deep-equal@^3.1.3:
|
||||
version "3.1.3"
|
||||
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
|
||||
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==
|
||||
|
Reference in New Issue
Block a user