frictionlessdata / tableschema-js

A JavaScript library for working with Table Schema.
http://frictionlessdata.io/
MIT License
82 stars 27 forks source link

Schema.infer mutates rows #127

Closed ghost closed 6 years ago

ghost commented 6 years ago

Noticed that when data sent to schema.infer, indicating that headers are in row 1, the incoming data is stripped of headers - so also updating the caller's data. https://github.com/frictionlessdata/tableschema-js/blob/master/src/schema.js#L186

Is this intentional (as it seems it shouldn't do this)?

roll commented 6 years ago

@mattRedBox Thanks. I've fixed it.

sebasalvarado commented 6 years ago

^^ This broke my application as itn's not supported in Node.js 6 Object.entries

roll commented 6 years ago

@sebasalvarado Could you please provide more info. This changes only includes addition use of lodash.cloneDeep which was already imported in prev versions.

Also on the release stage, we transpile the whole codebase to the EcmaScript5 (have to check exact version but definitely supported by Node.js 6)

sebasalvarado commented 6 years ago

@roll I am running Node 6.11.1 and this was the stack trace I received.

    at inspectValue (/home/vcap/app/node_modules/tableschema/lib/schema.js:580:36)
    at Schema.infer (/home/vcap/app/node_modules/tableschema/lib/schema.js:215:47)
    at Table._callee3$ (/home/vcap/app/node_modules/tableschema/lib/table.js:516:26)
    at tryCatch (/home/vcap/app/node_modules/regenerator-runtime/runtime.js:62:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (/home/vcap/app/node_modules/regenerator-runtime/runtime.js:296:22)```

This is what I have in `package.json`
```    "tableschema": "^1.4.2",

Can you confirm which release was breaking? We think that going with 1.5.0 would be safest

roll commented 6 years ago

@sebasalvarado Please create a dedicated issue with the full stack trace.