1
0
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:
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

@@ -0,0 +1,5 @@
---
'slate': patch
---
Removed lodash dependecy to reduce bundled footprint

View File

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

View File

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

View File

@@ -5656,7 +5656,7 @@ faker@^4.1.0:
resolved "https://registry.yarnpkg.com/faker/-/faker-4.1.0.tgz#1e45bbbecc6774b3c195fad2835109c6d748cc3f" resolved "https://registry.yarnpkg.com/faker/-/faker-4.1.0.tgz#1e45bbbecc6774b3c195fad2835109c6d748cc3f"
integrity sha1-HkW7vsxndLPBlfrSg1EJxtdIzD8= 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" version "3.1.3"
resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525"
integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==