You probably won't notice the increase in speed, but it's just kinda the
"standard" way of checking for Arrays... and, more importantly, it won't be
wrong


On Sat, Jun 15, 2013 at 11:20 PM, Jeff Escalante
<notifications@github.com>wrote:

> In lib/global_config.js:
>
> > +  if (fs.existsSync(config_path)) { return read() } else { return create() }
> > +}
> > +
> > +// write a javascript object to the config file as yaml
> > +function write(content){
> > +  var to_yaml = yaml.safeDump(content);
> > +  fs.writeFileSync(config_path, to_yaml);
> > +  return content
> > +}
> > +
> > +// because javascript's type checking is terrible
> > +function get_type(x){
> > +  if (typeof x !== 'object'){
> > +    return typeof x;
> > +  } else {
> > +    if (x instanceof Array) { return 'array' } else { return 'object' }
>
> I don't see why this is any better. Is it faster? Doesn't seem much
> cleaner...
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/jenius/roots/pull/166/files#r4715401>
> .
>