Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cmk-checklist

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cmk-checklist - npm Package Compare versions

Comparing version 0.90.3 to 0.91.0

4

build/checklist.d.ts

@@ -28,3 +28,3 @@ export declare type Encoding = 'Shift_JIS' | 'ISO-2022-JP' | 'EUC-JP' | 'UTF-8';

circleNameYomi: string;
penName?: string;
penName: string;
bookName?: string;

@@ -50,3 +50,3 @@ url?: string;

circleNameYomi: string;
penName?: string;
penName: string;
memo?: string;

@@ -53,0 +53,0 @@ colorNumber?: number;

@@ -21,49 +21,57 @@ "use strict";

return new Promise((resolve, reject) => {
const detected = Encoding.detect(input);
const converted = Encoding.convert(input, { to: 'UNICODE', type: 'string' });
parse(converted, {
relax_column_count: true,
skip_empty_lines: true,
}, (err, data) => {
if (err !== null) {
reject(err);
}
const ret = data;
if (ret.length <= 0 || ret[0].length <= 3 || ret[0][0] !== ListRecordHeader) {
reject(new Error('Invalid checklist format'));
}
// check header encoding
if (typeof input === 'string') {
resolve(ret);
}
if (detected === 'ASCII') {
resolve(ret);
}
switch (ret[0][3].toLowerCase()) {
case 'shift_jis':
if (detected !== 'SJIS') {
reject(new Error('Invalid encode'));
try {
const detected = Encoding.detect(input);
const converted = Encoding.convert(input, { to: 'UNICODE', type: 'string' });
parse(converted, {
relax_column_count: true,
skip_empty_lines: true,
}, (err, data) => {
if (err !== null) {
reject(err);
}
else {
const ret = data;
if (ret.length <= 0 || ret[0].length <= 3 || ret[0][0] !== ListRecordHeader) {
reject(new Error('Invalid checklist format'));
}
break;
case 'iso-2022-jp':
if (detected !== 'JIS') {
reject(new Error('Invalid encode'));
// check header encoding
if (typeof input === 'string') {
resolve(ret);
}
break;
case 'euc-jp':
if (detected !== 'EUCJP') {
reject(new Error('Invalid encode'));
if (detected === 'ASCII') {
resolve(ret);
}
break;
case 'utf-8':
if (detected !== 'UTF8') {
reject(new Error('Invalid encode'));
switch (ret[0][3].toLowerCase()) {
case 'shift_jis':
if (detected !== 'SJIS') {
reject(new Error('Invalid encode'));
}
break;
case 'iso-2022-jp':
if (detected !== 'JIS') {
reject(new Error('Invalid encode'));
}
break;
case 'euc-jp':
if (detected !== 'EUCJP') {
reject(new Error('Invalid encode'));
}
break;
case 'utf-8':
if (detected !== 'UTF8') {
reject(new Error('Invalid encode'));
}
break;
default:
reject(new Error('Invalid encode'));
break;
}
break;
default:
reject(new Error('Invalid encode'));
break;
}
resolve(ret);
});
resolve(ret);
}
});
}
catch (e) {
console.log('parse error');
reject(e);
}
});

@@ -172,3 +180,3 @@ }

circleNameYomi: circleNameYomi,
penName: readAsStr(row[12]),
penName: readAsStr(row[12]) || '',
bookName: readAsStr(row[13]),

@@ -210,3 +218,3 @@ url: readAsStr(row[14]),

circleNameYomi: circleNameYomi,
penName: readAsStr(row[3]),
penName: readAsStr(row[3]) || '',
memo: readAsStr(row[4]),

@@ -213,0 +221,0 @@ colorNumber: readAsNum(row[5]),

{
"name": "cmk-checklist",
"version": "0.90.3",
"compliantComiketNumber": 90,
"version": "0.91.0",
"compliantComiketNumber": 91,
"description": "Read/Write CSV files for Comiket catalog checklist",

@@ -6,0 +6,0 @@ "keywords": ["comiket", "comic market"],

@@ -52,11 +52,11 @@ # cmk-checklist

const file = fs.readFileSync('./checklist.csv');
let checklist = await checklist.read(file);
let chk = await checklist.read(file);
// チェックリストを新規作成
checklist = new checklist.Checklist();
chk = new checklist.Checklist();
// コミケ開催番号を指定して作成
checklist = new checklist.Checklist(90);
chk = new checklist.Checklist(91);
// サークルを追加
checklist.circles.append({
chk.circles.append({
serialNumber: 129936,

@@ -78,3 +78,3 @@ colorNumber: 1,

// チェックリストを書き込み
const output = await checklist.write(checklist);
const output = await checklist.write(chk);
fs.writeFileSync('./output.csv', new Buffer(output));

@@ -81,0 +81,0 @@ }

@@ -35,3 +35,3 @@ import {Version, CompliantComiketNumber} from './main';

circleNameYomi: string;
penName?: string;
penName: string;
bookName?: string;

@@ -58,3 +58,3 @@ url?: string;

circleNameYomi: string;
penName?: string;
penName: string;
memo?: string;

@@ -61,0 +61,0 @@ colorNumber?: number;

@@ -15,52 +15,59 @@ import * as parse from 'csv-parse';

return new Promise((resolve, reject) => {
const detected = Encoding.detect(input);
const converted = Encoding.convert(input, {to: 'UNICODE', type: 'string'}) as string;
try {
const detected = Encoding.detect(input);
const converted = Encoding.convert(input, {to: 'UNICODE', type: 'string'}) as string;
parse(converted, {
relax_column_count: true,
skip_empty_lines: true,
}, (err, data) => {
if (err !== null) {
reject(err);
}
const ret = data as string[][];
parse(converted, {
relax_column_count: true,
skip_empty_lines: true,
}, (err, data) => {
if (err !== null) {
reject(err);
}
else {
const ret = data as string[][];
if (ret.length <= 0 || ret[0].length <= 3 || ret[0][0] !== ListRecordHeader) {
reject(new Error('Invalid checklist format'));
}
if (ret.length <= 0 || ret[0].length <= 3 || ret[0][0] !== ListRecordHeader) {
reject(new Error('Invalid checklist format'));
}
// check header encoding
if (typeof input === 'string') {
resolve(ret);
}
if (detected === 'ASCII') {
resolve(ret);
}
switch (ret[0][3].toLowerCase()) {
case 'shift_jis':
if (detected !== 'SJIS') {
reject(new Error('Invalid encode'));
// check header encoding
if (typeof input === 'string') {
resolve(ret);
}
break;
case 'iso-2022-jp':
if (detected !== 'JIS') {
reject(new Error('Invalid encode'));
if (detected === 'ASCII') {
resolve(ret);
}
break;
case 'euc-jp':
if (detected !== 'EUCJP') {
reject(new Error('Invalid encode'));
switch (ret[0][3].toLowerCase()) {
case 'shift_jis':
if (detected !== 'SJIS') {
reject(new Error('Invalid encode'));
}
break;
case 'iso-2022-jp':
if (detected !== 'JIS') {
reject(new Error('Invalid encode'));
}
break;
case 'euc-jp':
if (detected !== 'EUCJP') {
reject(new Error('Invalid encode'));
}
break;
case 'utf-8':
if (detected !== 'UTF8') {
reject(new Error('Invalid encode'));
}
break;
default:
reject(new Error('Invalid encode'));
break;
}
break;
case 'utf-8':
if (detected !== 'UTF8') {
reject(new Error('Invalid encode'));
}
break;
default:
reject(new Error('Invalid encode'));
break;
}
resolve(ret);
});
resolve(ret);
}
});
} catch (e) {
console.log('parse error');
reject(e);
}
});

@@ -172,3 +179,3 @@ }

circleNameYomi: circleNameYomi,
penName: readAsStr(row[12]),
penName: readAsStr(row[12]) || '',
bookName: readAsStr(row[13]),

@@ -212,3 +219,3 @@ url: readAsStr(row[14]),

circleNameYomi: circleNameYomi,
penName: readAsStr(row[3]),
penName: readAsStr(row[3]) || '',
memo: readAsStr(row[4]),

@@ -215,0 +222,0 @@ colorNumber: readAsNum(row[5]),

@@ -60,2 +60,10 @@ /// <reference path="./../node_modules/typescript/lib/lib.es6.d.ts" />

});
it('should throw error on parsing invalid file', () => {
const str = fs.readFileSync(__dirname + '/main.test.ts');
return index.read(str).then(assert.fail, (error) => {
assert.notEqual(error, null);
});
});
});

@@ -239,2 +247,10 @@

});
it('should throw error on reading invalid file', () => {
const str = fs.readFileSync(__dirname + '/main.test.ts');
return index.read(str).then(assert.fail, (error) => {
assert.notEqual(error, null);
});
});
});

@@ -241,0 +257,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc