Skip to content

Commit

Permalink
chore: remove useless "use strict" from TS code
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed Jun 3, 2024
1 parent e2ee391 commit b299836
Show file tree
Hide file tree
Showing 62 changed files with 5 additions and 119 deletions.
2 changes: 0 additions & 2 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
extends: cheminfo-typescript
env:
node: true
parserOptions:
sourceType: script
2 changes: 2 additions & 0 deletions builder/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
parserOptions:
sourceType: script
1 change: 0 additions & 1 deletion builder/createStatesJs.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ const statesObject = {
};

const result = [];
result.push("'use strict';");
result.push(`const states = ${JSON.stringify(statesObject, null, 2)};`);
result.push('Object.freeze(states);');
result.push('export default states;');
Expand Down
2 changes: 0 additions & 2 deletions src/formats.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

export type FormatType = keyof typeof formats;

export const formats = {
Expand Down
2 changes: 0 additions & 2 deletions src/generated/__tests__/states.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import states from '../states';

describe('check countries', function () {
Expand Down
1 change: 0 additions & 1 deletion src/generated/states.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
'use strict';
const states = {
"AFG": "Afghanistan",
"ALB": "Albania",
Expand Down
2 changes: 0 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { formats } from './formats';
import states from './generated/states';
import parse from './parse/parse';
Expand Down
2 changes: 0 additions & 2 deletions src/parse/__tests__/errors.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import parse from '../parse';

describe('Bad MRZ', () => {
Expand Down
2 changes: 0 additions & 2 deletions src/parse/__tests__/frenchDrivingLicense.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import parse from '../parse';

describe('parse French Driving License', () => {
Expand Down
2 changes: 0 additions & 2 deletions src/parse/__tests__/frenchNationalId.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import parse from '../parse';

describe('parse French National Id', () => {
Expand Down
2 changes: 0 additions & 2 deletions src/parse/__tests__/swissDrivingLicense.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import parse from '../parse';

describe('parse Swiss Driving License', () => {
Expand Down
2 changes: 0 additions & 2 deletions src/parse/__tests__/td1.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import parse from '../parse';

describe('parse TD1', () => {
Expand Down
2 changes: 0 additions & 2 deletions src/parse/__tests__/td2.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import parse from '../parse';

describe('parse TD2', () => {
Expand Down
2 changes: 0 additions & 2 deletions src/parse/__tests__/td3.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import parse from '../parse';

describe('parse TD3', () => {
Expand Down
2 changes: 0 additions & 2 deletions src/parse/autoCorrection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { Autocorrect } from '../types';

import { FieldOptions, fieldTypes } from './createFieldParser';
Expand Down
2 changes: 0 additions & 2 deletions src/parse/checkLines.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

export function checkLines(lines: string | string[]) {
if (typeof lines === 'string') {
lines = lines.split(/[\r\n]+/);
Expand Down
2 changes: 0 additions & 2 deletions src/parse/createFieldParser.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { ParseTextError } from '../parsers/parseText';
import { Autocorrect, Details, FieldName, Range } from '../types';

Expand Down
2 changes: 0 additions & 2 deletions src/parse/fieldTemplates.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import parseCompositeCheckDigit from '../parsers/parseCompositeCheckDigit';
import parseDate from '../parsers/parseDate';
import parseDateCheckDigit from '../parsers/parseDateCheckDigit';
Expand Down
2 changes: 0 additions & 2 deletions src/parse/frenchDrivingLicence.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { formats } from '../formats';

import frenchDrivingLicenceFields from './frenchDrivingLicenceFields';
Expand Down
2 changes: 0 additions & 2 deletions src/parse/frenchDrivingLicenceFields.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import parseDocumentCode from '../parsers/frenchDrivingLicence/parseDocumentCode';
import { parseAlpha } from '../parsers/parseAlpha';

Expand Down
2 changes: 0 additions & 2 deletions src/parse/frenchNationalId.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { formats } from '../formats';

import frenchNationalIdFields from './frenchNationalIdFields';
Expand Down
2 changes: 0 additions & 2 deletions src/parse/frenchNationalIdFields.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { parseAlpha } from '../parsers/parseAlpha';
import parseDocumentCode from '../parsers/parseDocumentCodeId';
import { parseOptional } from '../parsers/parseOptional';
Expand Down
2 changes: 0 additions & 2 deletions src/parse/getResult.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { FormatType } from '../formats';
import { Autocorrect, Details, FieldRecords, ParseResult } from '../types';

Expand Down
5 changes: 3 additions & 2 deletions src/parse/parse.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
'use strict';
import { ParseResult } from '../types';

import { checkLines } from './checkLines';
import { parsers } from './parsers';

export interface ParseMRZOptions {
autocorrect?: boolean;
}

function parseMRZ(
inputLines: string | string[],
options: ParseMRZOptions = {},
) {
): ParseResult {
const lines = checkLines(inputLines);
switch (lines.length) {
case 1: {
Expand Down
2 changes: 0 additions & 2 deletions src/parse/parsers.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import parseFrenchDrivingLicense from './frenchDrivingLicence';
import parseFrenchNationalId from './frenchNationalId';
import parseSwissDrivingLicense from './swissDrivingLicense';
Expand Down
2 changes: 0 additions & 2 deletions src/parse/swissDrivingLicense.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { formats } from '../formats';

import { getResult } from './getResult';
Expand Down
2 changes: 0 additions & 2 deletions src/parse/swissDrivingLicenseFields.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { parseNumber } from '../parsers/parseNumber';
import { checkSeparator } from '../parsers/swissDrivingLicense/checkSeparator';
import parseDocumentCode from '../parsers/swissDrivingLicense/parseDocumentCode';
Expand Down
2 changes: 0 additions & 2 deletions src/parse/td1.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { formats } from '../formats';

import { getResult } from './getResult';
Expand Down
2 changes: 0 additions & 2 deletions src/parse/td1Fields.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import parseDocumentCode from '../parsers/parseDocumentCodeId';
import { parseDocumentNumberOptional } from '../parsers/parseDocumentNumberOptional';
import { parseOptional } from '../parsers/parseOptional';
Expand Down
2 changes: 0 additions & 2 deletions src/parse/td2.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { formats } from '../formats';

import { getResult } from './getResult';
Expand Down
2 changes: 0 additions & 2 deletions src/parse/td2Fields.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import parseDocumentCode from '../parsers/parseDocumentCodeId';
import { parseOptional } from '../parsers/parseOptional';

Expand Down
2 changes: 0 additions & 2 deletions src/parse/td3.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { formats } from '../formats';

import { getResult } from './getResult';
Expand Down
2 changes: 0 additions & 2 deletions src/parse/td3Fields.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import parseDocumentCode from '../parsers/parseDocumentCodePassport';
import { parsePersonalNumber } from '../parsers/parsePersonalNumber';
import { parsePersonalNumberCheckDigit } from '../parsers/parsePersonalNumberCheckDigit';
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/__tests__/check.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { check } from '../check';

test('check digits', () => {
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/check.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

export function check(string: string, value: string | number) {
let code = 0;
const factors = [7, 3, 1];
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/cleanText.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

export function cleanText(string: string) {
return string.replace(/<+$/g, '').replace(/</g, ' ');
}
2 changes: 0 additions & 2 deletions src/parsers/frenchDrivingLicence/parseDocumentCode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

/**
* D1 seems to be the most common,
* but with Google image search we can find some B1, A1, A2
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parseAlpha.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { cleanText } from './cleanText';

export function parseAlpha(source: string) {
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parseCompositeCheckDigit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { check } from './check';

export default function parseCompositeCheckDigit(
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parseDate.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

export default function parseDate(value: string) {
if (!value.match(/^[0-9<]{4,6}$/)) {
throw new Error(`invalid date: ${value}`);
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parseDateCheckDigit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { check } from './check';

export default function parseCheckDigit(checkDigit: string, value: string) {
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parseDocumentCodeId.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

export default function parseDocumentCodeId(source: string) {
const first = source.charAt(0);
if (first !== 'A' && first !== 'C' && first !== 'I') {
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parseDocumentCodePassport.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

export default function parseDocumentCodePassport(source: string) {
const first = source.charAt(0);
if (first !== 'P') {
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parseDocumentNumber.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { cleanText } from './cleanText';

export default function parseDocumentNumber(
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parseDocumentNumberCheckDigit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { check } from './check';

export default function parseDocumentNumberCheckDigit(
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parseDocumentNumberOptional.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { parseText } from './parseText';

export function parseDocumentNumberOptional(
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parseFirstName.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { parseText } from './parseText';

export default function parseFirstName(source: string) {
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parseLastName.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { parseText } from './parseText';

export default function parseLastName(source: string) {
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parseNumber.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

export function parseNumber(source: string) {
if (!source.match(/^[0-9]+$/)) {
throw new Error(`invalid number: ${source}`);
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parseOptional.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { parseText } from './parseText';

export function parseOptional(source: string) {
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parsePersonalNumber.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { parseText } from './parseText';

export function parsePersonalNumber(source: string) {
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parsePersonalNumberCheckDigit.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { check } from './check';
import { cleanText } from './cleanText';

Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parseSex.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

export default function parseSex(source: string) {
switch (source) {
case 'M':
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parseState.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import STATES from '../generated/states';

import { cleanText } from './cleanText';
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/parseText.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import { cleanText } from './cleanText';

export function parseText(
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/swissDrivingLicense/checkSeparator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

export function checkSeparator(source: string) {
if (!source.match(/^<*$/)) {
throw new Error(
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/swissDrivingLicense/parseDocumentCode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

export default function parseDocumentCode(source: string) {
if (source !== 'FA') {
throw new Error(`invalid document code: ${source}. Must be FA`);
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/swissDrivingLicense/parseDocumentNumber.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

import parseLanguageCode from './parseLanguageCode';

export default function parseDocumentNumber(source: string) {
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/swissDrivingLicense/parseIssuingState.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

export default function parseIssuingState(source: string) {
if (source !== 'CHE' && source !== 'LIE') {
throw new Error(`invalid state code: ${source}. Must be CHE or LIE`);
Expand Down
2 changes: 0 additions & 2 deletions src/parsers/swissDrivingLicense/parseLanguageCode.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

export default function parseLanguageCode(languageCode: string) {
switch (languageCode) {
case 'D':
Expand Down
2 changes: 0 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use strict';

export interface Autocorrect {
line: number;
column: number;
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"checkJs": true,
"esModuleInterop": true,
"moduleResolution": "node",
"noImplicitAny": false,
Expand Down

0 comments on commit b299836

Please sign in to comment.