UNPKG

csv_4180

Version:

CSV according to RFC 4180. Everyone else's are weirdly wrong. Heavily tested; in typescript

26 lines 1.62 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); const ava_spec_1 = require("ava-spec"); const to_csv_1 = require("../to_csv"); ava_spec_1.describe('quoteStrictNL', (it) => __awaiter(this, void 0, void 0, function* () { it('a', t => t.is('a', to_csv_1.quoteStrictNL('a'))); it('b"c', t => t.is('"b""c"', to_csv_1.quoteStrictNL('b"c'))); it('"d"', t => t.is('"""d"""', to_csv_1.quoteStrictNL('"d"'))); it('""e""', t => t.is('"""""e"""""', to_csv_1.quoteStrictNL('""e""'))); it('f\ng', t => t.is('f\ng', to_csv_1.quoteStrictNL('f\ng'))); it('h\ri', t => t.is('h\ri', to_csv_1.quoteStrictNL('h\ri'))); it('j\r\nk', t => t.is('"j\r\nk"', to_csv_1.quoteStrictNL('j\r\nk'))); it('1', t => t.is('1', to_csv_1.quoteStrictNL('1'))); it('-2', t => t.is('-2', to_csv_1.quoteStrictNL('-2'))); it('+3', t => t.is('+3', to_csv_1.quoteStrictNL('+3'))); it('4.0', t => t.is('4.0', to_csv_1.quoteStrictNL('4.0'))); })); //# sourceMappingURL=quoteStrictNL.js.map