我正在开始一个导入CSV,转换并重新导出回新CSV的项目。第一步是启动并运行Node CSV。
我已将node-csv-npm软件包安装到我的Meteor app目录,并在终端中确认我“已经在使用”node-csv-npm。
然而,出于某种原因,当我运行基本示例来测试我的设置(参见代码)时,我会回来“未捕获的ReferenceError:未定义csv”
我正在使用的简单咖啡代码:
if Meteor.isClient
console.log "client started."
csv().from.string("#Welcome\n\"1\",\"2\",\"3\",\"4\"\n\"a\",\"b\",\"c\",\"d\"", comment: "#").to.array (data) ->
console.log data
# [ [ '1', '2', '3', '4' ], [ 'a', 'b', 'c', 'd' ] ]
if Meteor.isServer
console.log "Server Started"
感谢您的任何见解!
根据评论中的要求,发布整个应用代码(.coffee文件)
if Meteor.isClient
console.log "Client Started"
if Meteor.isServer
console.log "Server Started"
csv().from.string("#Welcome\n\"1\",\"2\",\"3\",\"4\"\n\"a\",\"b\",\"c\",\"d\"", comment: "#").to.array (data) ->
console.log data
# [ [ '1', '2', '3', '4' ], [ 'a', 'b', 'c', 'd' ] ]