-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Make swr zero dependencies * mark license
- Loading branch information
Showing
4 changed files
with
38 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* deep equal lite version from dequal | ||
* https://github.com/lukeed/dequal/blob/master/license | ||
*/ | ||
|
||
const has = Object.prototype.hasOwnProperty | ||
|
||
export default function deepEqual(foo: any, bar: any) { | ||
let ctor, len | ||
if (foo === bar) return true | ||
|
||
if (foo && bar && (ctor = foo.constructor) === bar.constructor) { | ||
if (ctor === Date) return foo.getTime() === bar.getTime() | ||
if (ctor === RegExp) return foo.toString() === bar.toString() | ||
|
||
if (ctor === Array) { | ||
if ((len = foo.length) === bar.length) { | ||
while (len && deepEqual(foo[len], bar[len])) { | ||
len-- | ||
} | ||
} | ||
return len === -1 | ||
} | ||
|
||
if (!ctor || typeof foo === 'object') { | ||
len = 0 | ||
for (ctor in foo) { | ||
if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false | ||
if (!(ctor in bar) || !deepEqual(foo[ctor], bar[ctor])) return false | ||
} | ||
return Object.keys(bar).length === len | ||
} | ||
} | ||
|
||
return foo !== foo && bar !== bar | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1737,11 +1737,6 @@ delayed-stream@~1.0.0: | |
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" | ||
integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk= | ||
|
||
[email protected]: | ||
version "2.0.2" | ||
resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.2.tgz#85ca22025e3a87e65ef75a7a437b35284a7e319d" | ||
integrity sha512-q9K8BlJVxK7hQYqa6XISGmBZbtQQWVXSrRrWreHC94rMt1QL/Impruc+7p2CYSYuVIUr+YCt6hjrs1kkdJRTug== | ||
|
||
detect-newline@^3.0.0: | ||
version "3.1.0" | ||
resolved "https://registry.yarnpkg.com/detect-newline/-/detect-newline-3.1.0.tgz#576f5dfc63ae1a192ff192d8ad3af6308991b651" | ||
|