1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | var is_nil_1 = require("./is-nil");
|
4 | var is_array_like_1 = require("./is-array-like");
|
5 | var get_type_1 = require("./get-type");
|
6 | var is_prototype_1 = require("./is-prototype");
|
7 | var hasOwnProperty = Object.prototype.hasOwnProperty;
|
8 | function isEmpty(value) {
|
9 | |
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | if (is_nil_1.default(value)) {
|
19 | return true;
|
20 | }
|
21 | if (is_array_like_1.default(value)) {
|
22 | return !value.length;
|
23 | }
|
24 | var type = get_type_1.default(value);
|
25 | if (type === 'Map' || type === 'Set') {
|
26 | return !value.size;
|
27 | }
|
28 | if (is_prototype_1.default(value)) {
|
29 | return !Object.keys(value).length;
|
30 | }
|
31 | for (var key in value) {
|
32 | if (hasOwnProperty.call(value, key)) {
|
33 | return false;
|
34 | }
|
35 | }
|
36 | return true;
|
37 | }
|
38 | exports.default = isEmpty;
|
39 |
|
\ | No newline at end of file |