Brandon Benvie (2013-08-03T22:10:51.000Z)
On 8/3/2013 12:30 PM, David Bruant wrote:
> That said, I recently worked on a project and I reviewed a pull 
> request with "typeof x === 'object'" to ask to replace to 'Object(x) 
> === x'.

I was actually the original author of that code. =D The function was:

```js
function isObject(value){
   let type = typeof value;
   return type == "object" ? value !== null : type == "function";
}
```

Which would work just fine if typeof null was "null".

On a side note, I think your version of isObject is problematic because 
it requires allocating an object every time the function encounters a 
primitive. I'd prefer avoiding the unnecessary allocation in a function 
that is likely to be called very often.
domenic at domenicdenicola.com (2013-08-12T05:26:00.311Z)
On 8/3/2013 12:30 PM, David Bruant wrote:
> That said, I recently worked on a project and I reviewed a pull 
> request with "typeof x === 'object'" to ask to replace to 'Object(x) === x'.

I was actually the original author of that code. =D The function was:

```js
function isObject(value){
   let type = typeof value;
   return type == "object" ? value !== null : type == "function";
}
```

Which would work just fine if typeof null was "null".

On a side note, I think your version of isObject is problematic because 
it requires allocating an object every time the function encounters a 
primitive. I'd prefer avoiding the unnecessary allocation in a function 
that is likely to be called very often.