@studiometa/js-toolkit 2.0.0-beta.5 → 2.0.0-beta.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,17 +9,32 @@ class Pointer extends Service {
9
9
  constructor() {
10
10
  super(...arguments);
11
11
 
12
- _defineProperty(this, "isDown", false);
13
-
14
- _defineProperty(this, "y", window.innerHeight / 2);
15
-
16
- _defineProperty(this, "yLast", window.innerHeight / 2);
17
-
18
- _defineProperty(this, "x", window.innerWidth / 2);
19
-
20
- _defineProperty(this, "xLast", window.innerWidth / 2);
21
-
22
- _defineProperty(this, "event", void 0);
12
+ _defineProperty(this, "props", {
13
+ event: null,
14
+ isDown: false,
15
+ x: window.innerWidth / 2,
16
+ y: window.innerHeight / 2,
17
+ changed: {
18
+ x: false,
19
+ y: false
20
+ },
21
+ last: {
22
+ x: window.innerWidth / 2,
23
+ y: window.innerHeight / 2
24
+ },
25
+ delta: {
26
+ x: 0,
27
+ y: 0
28
+ },
29
+ progress: {
30
+ x: 0.5,
31
+ y: 0.5
32
+ },
33
+ max: {
34
+ x: window.innerWidth,
35
+ y: window.innerHeight
36
+ }
37
+ });
23
38
 
24
39
  _defineProperty(this, "hasRaf", false);
25
40
  }
@@ -73,86 +88,68 @@ class Pointer extends Service {
73
88
  }
74
89
 
75
90
  handler(event) {
76
- this.updateValues(event);
91
+ this.updateProps(event);
77
92
  this.trigger(this.props);
78
93
  }
79
94
 
80
95
  downHandler() {
81
- this.isDown = true;
96
+ this.props.isDown = true;
82
97
  this.trigger(this.props);
83
98
  }
84
99
 
85
100
  upHandler() {
86
- this.isDown = false;
101
+ this.props.isDown = false;
87
102
  this.trigger(this.props);
88
103
  }
89
104
 
90
- updateValues(event) {
105
+ updateProps(event) {
91
106
  var _event$touches$, _event$touches$2;
92
107
 
93
- this.event = event;
94
- this.yLast = this.y;
95
- this.xLast = this.x;
108
+ this.props.event = event;
109
+ var yLast = this.props.y;
110
+ var xLast = this.props.x;
96
111
  var y = isTouchEvent(event) ? (_event$touches$ = event.touches[0]) === null || _event$touches$ === void 0 ? void 0 : _event$touches$.clientY : event.clientY;
97
112
 
98
- if (y !== this.y) {
99
- this.y = y;
113
+ if (y !== this.props.y) {
114
+ this.props.y = y;
100
115
  }
101
116
 
102
117
  var x = isTouchEvent(event) ? (_event$touches$2 = event.touches[0]) === null || _event$touches$2 === void 0 ? void 0 : _event$touches$2.clientX : event.clientX;
103
118
 
104
- if (x !== this.x) {
105
- this.x = x;
119
+ if (x !== this.props.x) {
120
+ this.props.x = x;
106
121
  }
107
- }
108
122
 
109
- get props() {
110
- return {
111
- event: this.event,
112
- isDown: this.isDown,
113
- x: this.x,
114
- y: this.y,
115
- changed: {
116
- x: this.x !== this.xLast,
117
- y: this.y !== this.yLast
118
- },
119
- last: {
120
- x: this.xLast,
121
- y: this.yLast
122
- },
123
- delta: {
124
- x: this.x - this.xLast,
125
- y: this.y - this.yLast
126
- },
127
- progress: {
128
- x: this.x / window.innerWidth,
129
- y: this.y / window.innerHeight
130
- },
131
- max: {
132
- x: window.innerWidth,
133
- y: window.innerHeight
134
- }
135
- };
123
+ this.props.changed.x = this.props.x !== xLast;
124
+ this.props.changed.y = this.props.y !== yLast;
125
+ this.props.last.x = xLast;
126
+ this.props.last.y = yLast;
127
+ this.props.delta.x = this.props.x - xLast;
128
+ this.props.delta.y = this.props.y - yLast;
129
+ this.props.max.x = window.innerWidth;
130
+ this.props.max.y = window.innerHeight;
131
+ this.props.progress.x = this.props.x / this.props.max.x;
132
+ this.props.progress.y = this.props.y / this.props.max.y;
133
+ return this.props;
136
134
  }
137
135
 
138
136
  }
139
137
 
140
- var pointer = null;
138
+ var instance;
139
+ var pointer;
141
140
  export default function usePointer() {
142
141
  if (!pointer) {
143
- pointer = new Pointer();
144
- }
145
-
146
- var add = pointer.add.bind(pointer);
147
- var remove = pointer.remove.bind(pointer);
148
- var has = pointer.has.bind(pointer);
142
+ if (!instance) {
143
+ instance = new Pointer();
144
+ }
149
145
 
150
- var props = () => pointer.props;
146
+ pointer = {
147
+ add: instance.add.bind(instance),
148
+ remove: instance.remove.bind(instance),
149
+ has: instance.has.bind(instance),
150
+ props: instance.updateProps.bind(instance)
151
+ };
152
+ }
151
153
 
152
- return {
153
- add,
154
- remove,
155
- has,
156
- props
157
- };
154
+ return pointer;
158
155
  }
package/services/raf.d.ts CHANGED
@@ -9,20 +9,10 @@
9
9
  * props();
10
10
  * ```
11
11
  *
12
- * @return {ServiceInterface & RafService}
12
+ * @return {RafService}
13
13
  */
14
- export default function useRaf(): ServiceInterface & RafService;
15
- export type ServiceInterface = import('./index').ServiceInterface;
14
+ export default function useRaf(): RafService;
15
+ export type RafService = import('./index').ServiceInterface<RafServiceProps>;
16
16
  export type RafServiceProps = {
17
17
  time: DOMHighResTimeStamp;
18
18
  };
19
- export type RafService = {
20
- /**
21
- * Add a function to the resize service. The key must be uniq.
22
- */
23
- add: (key: string, callback: (props: RafServiceProps) => void) => void;
24
- /**
25
- * Get the current values of the resize service props.
26
- */
27
- props: () => RafServiceProps;
28
- };
package/services/raf.js CHANGED
@@ -4,7 +4,7 @@ import { getRaf, getCancelRaf } from '../utils/nextFrame.js';
4
4
 
5
5
  class Raf extends Service {
6
6
  constructor() {
7
- super();
7
+ super(...arguments);
8
8
 
9
9
  _defineProperty(this, "isTicking", false);
10
10
 
@@ -14,57 +14,54 @@ class Raf extends Service {
14
14
 
15
15
  _defineProperty(this, "cancelRaf", getCancelRaf());
16
16
 
17
- this.loop = this.loop.bind(this);
17
+ _defineProperty(this, "props", {
18
+ time: performance.now()
19
+ });
18
20
  }
19
21
 
20
22
  init() {
21
23
  this.isTicking = true;
22
24
  this.loop();
23
- return this;
24
25
  }
25
26
 
26
27
  loop() {
28
+ this.updateProps();
27
29
  this.trigger(this.props);
28
30
 
29
31
  if (!this.isTicking) {
30
32
  return;
31
33
  }
32
34
 
33
- this.id = this.raf(this.loop);
35
+ this.id = this.raf(() => this.loop());
34
36
  }
35
37
 
36
38
  kill() {
37
39
  this.cancelRaf(this.id);
38
40
  this.isTicking = false;
39
- return this;
40
41
  }
41
42
 
42
- get props() {
43
- return {
44
- time: window.performance.now()
45
- };
43
+ updateProps() {
44
+ this.props.time = window.performance.now();
45
+ return this.props;
46
46
  }
47
47
 
48
48
  }
49
49
 
50
- var instance = null;
50
+ var instance;
51
+ var raf;
51
52
  export default function useRaf() {
52
- if (!instance) {
53
- instance = new Raf();
54
- }
55
-
56
- var add = instance.add.bind(instance);
57
- var remove = instance.remove.bind(instance);
58
- var has = instance.has.bind(instance);
53
+ if (!raf) {
54
+ if (!instance) {
55
+ instance = new Raf();
56
+ }
59
57
 
60
- function props() {
61
- return instance.props;
58
+ raf = {
59
+ add: instance.add.bind(instance),
60
+ remove: instance.remove.bind(instance),
61
+ has: instance.has.bind(instance),
62
+ props: instance.updateProps.bind(instance)
63
+ };
62
64
  }
63
65
 
64
- return {
65
- add,
66
- remove,
67
- has,
68
- props
69
- };
66
+ return raf;
70
67
  }
@@ -8,10 +8,10 @@
8
8
  * remove(key);
9
9
  * props();
10
10
  * ```
11
- * @return {ServiceInterface & ResizeService}
11
+ * @return {ResizeService}
12
12
  */
13
- export default function useResize(): ServiceInterface & ResizeService;
14
- export type ServiceInterface = import('./index').ServiceInterface;
13
+ export default function useResize(): ResizeService;
14
+ export type ResizeService = import('./index').ServiceInterface<ResizeServiceProps>;
15
15
  export type ResizeServiceProps = {
16
16
  width: number;
17
17
  height: number;
@@ -20,13 +20,3 @@ export type ResizeServiceProps = {
20
20
  breakpoint?: string;
21
21
  breakpoints?: string[];
22
22
  };
23
- export type ResizeService = {
24
- /**
25
- * Add a function to the resize service. The key must be uniq.
26
- */
27
- add: (key: string, callback: (props: ResizeServiceProps) => void) => void;
28
- /**
29
- * Get the current values of the resize service props.
30
- */
31
- props: () => ResizeServiceProps;
32
- };
@@ -1,9 +1,24 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import Service from './Service.js';
2
3
  import debounce from '../utils/debounce.js';
3
4
 
4
5
  class Resize extends Service {
6
+ constructor() {
7
+ super(...arguments);
8
+
9
+ _defineProperty(this, "props", {
10
+ width: window.innerWidth,
11
+ height: window.innerHeight,
12
+ ratio: window.innerWidth / window.innerHeight,
13
+ orientation: 'square'
14
+ });
15
+
16
+ _defineProperty(this, "handler", void 0);
17
+ }
18
+
5
19
  init() {
6
20
  this.handler = debounce(() => {
21
+ this.updateProps();
7
22
  this.trigger(this.props);
8
23
  }).bind(this);
9
24
  window.addEventListener('resize', this.handler);
@@ -12,35 +27,35 @@ class Resize extends Service {
12
27
 
13
28
  kill() {
14
29
  window.removeEventListener('resize', this.handler);
15
- return this;
16
30
  }
17
31
 
18
- get props() {
19
- var props = {
20
- width: window.innerWidth,
21
- height: window.innerHeight,
22
- ratio: window.innerWidth / window.innerHeight,
23
- orientation: 'square'
24
- };
32
+ updateProps() {
33
+ this.props.width = window.innerWidth;
34
+ this.props.height = window.innerHeight;
35
+ this.props.ratio = window.innerWidth / window.innerHeight;
36
+ this.props.orientation = 'square';
25
37
 
26
- if (props.ratio > 1) {
27
- props.orientation = 'landscape';
38
+ if (this.props.ratio > 1) {
39
+ this.props.orientation = 'landscape';
28
40
  }
29
41
 
30
- if (props.ratio < 1) {
31
- props.orientation = 'portrait';
42
+ if (this.props.ratio < 1) {
43
+ this.props.orientation = 'portrait';
32
44
  }
33
45
 
34
46
  if (this.breakpointElement) {
35
- props.breakpoint = this.breakpoint;
36
- props.breakpoints = this.breakpoints;
47
+ this.props.breakpoint = this.breakpoint;
48
+ this.props.breakpoints = this.breakpoints;
49
+ } else {
50
+ this.props.breakpoint = undefined;
51
+ this.props.breakpoints = undefined;
37
52
  }
38
53
 
39
- return props;
54
+ return this.props;
40
55
  }
41
56
 
42
57
  get breakpointElement() {
43
- return document.querySelector('[data-breakpoint]') || null;
58
+ return document.querySelector('[data-breakpoint]');
44
59
  }
45
60
 
46
61
  get breakpoint() {
@@ -54,22 +69,25 @@ class Resize extends Service {
54
69
 
55
70
  }
56
71
 
57
- var resize = null;
72
+ var instance;
73
+ var resize;
58
74
  export default function useResize() {
59
75
  if (!resize) {
60
- resize = new Resize();
61
- }
62
-
63
- var add = resize.add.bind(resize);
64
- var remove = resize.remove.bind(resize);
65
- var has = resize.has.bind(resize);
76
+ if (!instance) {
77
+ instance = new Resize();
78
+ }
66
79
 
67
- var props = () => resize.props;
80
+ var add = instance.add.bind(instance);
81
+ var remove = instance.remove.bind(instance);
82
+ var has = instance.has.bind(instance);
83
+ var props = instance.updateProps.bind(instance);
84
+ resize = {
85
+ add,
86
+ remove,
87
+ has,
88
+ props
89
+ };
90
+ }
68
91
 
69
- return {
70
- add,
71
- remove,
72
- has,
73
- props
74
- };
92
+ return resize;
75
93
  }
@@ -9,10 +9,10 @@
9
9
  * props();
10
10
  * ```
11
11
  *
12
- * @return {ServiceInterface & ScrollService}
12
+ * @return {ScrollService}
13
13
  */
14
- export default function useScroll(): ServiceInterface & ScrollService;
15
- export type ServiceInterface = import('./index').ServiceInterface;
14
+ export default function useScroll(): ScrollService;
15
+ export type ScrollService = import('./index').ServiceInterface<ScrollServiceProps>;
16
16
  export type ScrollServiceProps = {
17
17
  x: number;
18
18
  y: number;
@@ -41,13 +41,3 @@ export type ScrollServiceProps = {
41
41
  y: 'UP' | 'DOWN' | 'NONE';
42
42
  };
43
43
  };
44
- export type ScrollService = {
45
- /**
46
- * Add a function to the resize service. The key must be uniq.
47
- */
48
- add: (key: string, callback: (props: ScrollServiceProps) => void) => void;
49
- /**
50
- * Get the current values of the resize service props.
51
- */
52
- props: () => ScrollServiceProps;
53
- };
@@ -6,16 +6,38 @@ class Scroll extends Service {
6
6
  constructor() {
7
7
  super(...arguments);
8
8
 
9
- _defineProperty(this, "y", window.pageYOffset);
10
-
11
- _defineProperty(this, "yLast", window.pageYOffset);
12
-
13
- _defineProperty(this, "x", window.pageXOffset);
14
-
15
- _defineProperty(this, "xLast", window.pageXOffset);
9
+ _defineProperty(this, "props", {
10
+ x: window.pageXOffset,
11
+ y: window.pageYOffset,
12
+ changed: {
13
+ x: false,
14
+ y: false
15
+ },
16
+ last: {
17
+ x: window.pageXOffset,
18
+ y: window.pageYOffset
19
+ },
20
+ delta: {
21
+ x: 0,
22
+ y: 0
23
+ },
24
+ max: {
25
+ x: (document.scrollingElement || document.body).scrollWidth - window.innerWidth,
26
+ y: (document.scrollingElement || document.body).scrollHeight - window.innerHeight
27
+ },
28
+ progress: {
29
+ x: 0,
30
+ y: 0
31
+ },
32
+ direction: {
33
+ x: 'NONE',
34
+ y: 'NONE'
35
+ }
36
+ });
16
37
  }
17
38
 
18
39
  init() {
40
+ this.updateProps();
19
41
  document.addEventListener('scroll', this, {
20
42
  passive: true,
21
43
  capture: true
@@ -25,8 +47,9 @@ class Scroll extends Service {
25
47
 
26
48
  get debouncedHandler() {
27
49
  var debounced = debounce(() => {
50
+ this.updateProps();
28
51
  this.trigger(this.props);
29
- }, 0);
52
+ }, 100);
30
53
  Object.defineProperty(this, 'debouncedHandler', {
31
54
  value: debounced
32
55
  });
@@ -34,6 +57,7 @@ class Scroll extends Service {
34
57
  }
35
58
 
36
59
  handleEvent() {
60
+ this.updateProps();
37
61
  this.trigger(this.props);
38
62
  this.debouncedHandler();
39
63
  }
@@ -43,70 +67,50 @@ class Scroll extends Service {
43
67
  return this;
44
68
  }
45
69
 
46
- get props() {
47
- this.yLast = this.y;
48
- this.xLast = this.x;
70
+ updateProps() {
71
+ var yLast = this.props.y;
72
+ var xLast = this.props.x;
49
73
 
50
- if (window.pageYOffset !== this.y) {
51
- this.y = window.pageYOffset;
74
+ if (window.pageYOffset !== this.props.y) {
75
+ this.props.y = window.pageYOffset;
52
76
  }
53
77
 
54
- if (window.pageXOffset !== this.x) {
55
- this.x = window.pageXOffset;
78
+ if (window.pageXOffset !== this.props.x) {
79
+ this.props.x = window.pageXOffset;
56
80
  }
57
81
 
58
- return {
59
- x: this.x,
60
- y: this.y,
61
- changed: {
62
- x: this.x !== this.xLast,
63
- y: this.y !== this.yLast
64
- },
65
- last: {
66
- x: this.xLast,
67
- y: this.yLast
68
- },
69
- delta: {
70
- x: this.x - this.xLast,
71
- y: this.y - this.yLast
72
- },
73
- progress: {
74
- x: this.max.x === 0 ? 1 : this.x / this.max.x,
75
- y: this.max.y === 0 ? 1 : this.y / this.max.y
76
- },
77
- direction: {
78
- x: this.x > this.xLast ? 'RIGHT' : this.x < this.xLast ? 'LEFT' : 'NONE',
79
- y: this.y > this.yLast ? 'DOWN' : this.y < this.yLast ? 'UP' : 'NONE'
80
- },
81
- max: this.max
82
- };
83
- }
84
-
85
- get max() {
86
- return {
87
- x: (document.scrollingElement || document.body).scrollWidth - window.innerWidth,
88
- y: (document.scrollingElement || document.body).scrollHeight - window.innerHeight
89
- };
82
+ this.props.changed.x = this.props.x !== xLast;
83
+ this.props.changed.y = this.props.y !== yLast;
84
+ this.props.last.x = xLast;
85
+ this.props.last.y = yLast;
86
+ this.props.delta.x = this.props.x - xLast;
87
+ this.props.delta.y = this.props.y - yLast;
88
+ this.props.max.x = (document.scrollingElement || document.body).scrollWidth - window.innerWidth;
89
+ this.props.max.y = (document.scrollingElement || document.body).scrollHeight - window.innerHeight;
90
+ this.props.progress.x = this.props.max.x === 0 ? 1 : this.props.x / this.props.max.x;
91
+ this.props.progress.y = this.props.max.y === 0 ? 1 : this.props.y / this.props.max.y;
92
+ this.props.direction.x = this.props.x > xLast ? 'RIGHT' : this.props.x < xLast ? 'LEFT' : 'NONE';
93
+ this.props.direction.y = this.props.y > yLast ? 'DOWN' : this.props.y < yLast ? 'UP' : 'NONE';
94
+ return this.props;
90
95
  }
91
96
 
92
97
  }
93
98
 
94
- var scroll = null;
99
+ var instance;
100
+ var scroll;
95
101
  export default function useScroll() {
96
102
  if (!scroll) {
97
- scroll = new Scroll();
98
- }
99
-
100
- var add = scroll.add.bind(scroll);
101
- var remove = scroll.remove.bind(scroll);
102
- var has = scroll.has.bind(scroll);
103
+ if (!instance) {
104
+ instance = new Scroll();
105
+ }
103
106
 
104
- var props = () => scroll.props;
107
+ scroll = {
108
+ add: instance.add.bind(instance),
109
+ remove: instance.remove.bind(instance),
110
+ has: instance.has.bind(instance),
111
+ props: instance.updateProps.bind(instance)
112
+ };
113
+ }
105
114
 
106
- return {
107
- add,
108
- remove,
109
- has,
110
- props
111
- };
115
+ return scroll;
112
116
  }
@@ -1,9 +1,9 @@
1
1
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
 
4
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
 
6
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
6
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
7
7
 
8
8
  import nextFrame from '../nextFrame.js';
9
9
  import * as classes from './classes.js';
package/utils/history.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
 
3
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
4
 
5
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
5
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
 
7
7
  import isObject from './object/isObject.js';
8
8
 
@@ -3,7 +3,7 @@ export default function getAllProperties(object) {
3
3
  var testFn = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
4
4
  var proto = Object.getPrototypeOf(object);
5
5
 
6
- if (proto === Object.prototype) {
6
+ if (proto === Object.prototype || proto === null) {
7
7
  return props;
8
8
  }
9
9