Skip to content

Commit

Permalink
fix exports and extensions
Browse files Browse the repository at this point in the history
  • Loading branch information
paed01 committed Mar 20, 2023
1 parent 83a22a2 commit 49fb3cb
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 164 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
coverage/
node_modules
tmp/
main.js
main.cjs
42 changes: 21 additions & 21 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,37 @@ interface AllOptions extends FixedOptions {
validation?: boolean | number;
}

interface Result {
numbers: string;
sum: number;
length: number;
type Result = {
numbers: string,
sum: number,
length: number,
}

interface GenerateResult extends Result{
lengthControl: number;
control: number;
}

interface ErrorResult {
error_code: string;
message: string;
}
type GenerateResult = {
lengthControl: number,
control: number,
};

interface ValidateResult {
valid: boolean;
control: number;
sum: number;
}
type ValidateResult = {
control: number,
sum: number,
error_code?: string,
message?: string,
};

export const MIN_LENGTH: 2;
export const MAX_LENGTH: 25;
export function generate(from: from, options?: FixedOptions): GenerateResult;

export const ERR_OUT_OF_RANGE: 'ERR_OCR_OUT_OF_RANGE';
export const ERR_INVALID_CHAR: 'ERR_OCR_INVALID_CHAR';

export function generate(from: from, options?: FixedOptions): Result & GenerateResult;
export function soft(from: from): string;
export function hard(from: from): string;
export function fixed(from: from, fixedLength: number): string;
export function validate(ocr: from, options?: LengthOptions): ValidateResult | ErrorResult;
export function validate(ocr: from, options?: LengthOptions): { valid: boolean } & ValidateResult;
export function validateFixedLength(ocr: from, length1: number, length2: number): boolean;
export function validateVariableLength(ocr: from): boolean;
export function validateSoft(ocr: from): boolean;
export function calculateChecksumReversed(from: from, options?: AllOptions): Result | ErrorResult;
export function calculateChecksumReversed(from: from, options?: AllOptions): ValidateResult;
export { validateSoft as validateHard };
137 changes: 0 additions & 137 deletions main.js

This file was deleted.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"name": "ocrgenerator",
"version": "1.0.1",
"version": "1.0.2",
"description": "Swedish invoice no generator",
"license": "MIT",
"author": {
"name": "Zerodep AB",
"url": "https://github.com/zerodep"
},
"type": "module",
"main": "main.js",
"main": "main.cjs",
"module": "index.js",
"typings": "index.d.ts",
"exports": {
"import": "./index.mjs",
"require": "./main.js"
"import": "./index.js",
"require": "./main.cjs"
},
"sideEffects": false,
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default {
],
output: [
{
file: 'main.js',
file: 'main.cjs',
format: 'cjs',
}
]
Expand Down

0 comments on commit 49fb3cb

Please sign in to comment.