Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

csv-to-js-parser

Package Overview
Dependencies
0
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.1 to 2.1.2

2

package.json
{
"name": "csv-to-js-parser",
"version": "2.1.1",
"version": "2.1.2",
"description": "Converting csv data into array of JavaScript objects. This module can group data from input tables.",

@@ -5,0 +5,0 @@ "main": "app.js",

@@ -65,2 +65,3 @@ # Преобразование данных csv в объекты JavaScript

```
Рассмотрим исходный код для получения такого объекта. Пусть нужная таблица хранится в файле "data.csv", где разделителями столбцов выступает символ ";".

@@ -86,2 +87,3 @@

```
Функция csvToObj принимает следующие параметры:

@@ -135,3 +137,5 @@ * data: csv таблица в виде строки.

```
Результат работы csvToObj будет таким:
```javascript

@@ -172,4 +176,2 @@ [

### Функция combineArrays

@@ -179,2 +181,3 @@

```javascript

@@ -184,2 +187,3 @@ const combineArrays = require('csv-to-js-parser').combineArrays;

```
Функция combineArrays принимает следующие параметры:

@@ -192,2 +196,3 @@ * obj: входной объект (обычно полученный из csvToObj).

Результат работы функции combineArrays для нашего примера из таблицы 1 представлен ниже:
```javascript

@@ -304,4 +309,2 @@ [

### Функция objToCsv

@@ -316,2 +319,3 @@

```
Функция objToCsv принимает следующие параметры:

@@ -318,0 +322,0 @@ * obj: входной массив объектов (формат должен соответствовать тому, который возвращает csvToObj).

@@ -31,4 +31,2 @@ # Convert csv data to an array of JavaScript objects

Таблица 1 интересна тем, что в ней есть столбцы, в которых по строкам встречаются повторяющиеся значения. Например, customer_id будет одинаковый в первых четырёх строках, так как эти строки описывают покупки одного и того же покупателя. В таких ситуациях обычно не требуется преобразовывать каждую строку в отдельный объект JavaScript, а нужно, чтобы был один объект на одного покупателя.
Table 1 has columns where repeated values occur in rows. For example, customer_id will be the same in the first four lines, as these lines describe the purchases of the same customer. In these situations, you usually don't need to convert each row to a separate JavaScript object, but it is necessary that there is one object per customer.

@@ -102,4 +100,2 @@

Рассмотрим другой пример, где можно лучше увидеть как работает группировка. Пусть в качестве входных данных выступает таблица 2.
Consider another example where you can better see how grouping works. Let the input data be table 2.

@@ -188,2 +184,3 @@

```
The combineArrays function takes the following parameters:

@@ -196,2 +193,3 @@ * obj: input object (usually from csvToObj).

The result of the combineArrays function for example from table 1 is shown below:
```javascript

@@ -281,4 +279,2 @@ [

### separateArrays function

@@ -285,0 +281,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc