Skip to content

Commit 91d7ed4

Browse files
author
Vlad Balin
committed
https://github.com/Volicon/NestedLink/issues/8
1 parent 73664c8 commit 91d7ed4

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

valuelink.js

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

valuelink.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

valuelink.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,18 @@ interface Helper {
247247
remove( obj : any, key : string | number ) : any
248248
}
249249

250+
const ArrayProto = Array.prototype,
251+
ObjectProto = Object.prototype;
252+
250253
function helpers( value ) : Helper {
251-
switch( value && Object.getPrototypeOf( value ) ){
252-
case Array.prototype :
253-
return arrayHelpers;
254-
case Object.prototype :
255-
return objectHelpers;
256-
default:
257-
return dummyHelpers;
254+
if( value && typeof value === 'object' ){
255+
switch( Object.getPrototypeOf( value ) ){
256+
case ArrayProto : return arrayHelpers;
257+
case ObjectProto : return objectHelpers;
258+
}
258259
}
260+
261+
return dummyHelpers;
259262
}
260263

261264
// Do nothing for types other than Array and plain Object.

0 commit comments

Comments
 (0)