Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

export COMUNI #108

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dist/codice-fiscale-var.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/codice.fiscale.amd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/codice.fiscale.commonjs2.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/codice.fiscale.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/codice.fiscale.var.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/codice-fiscale.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Comune } from './comune'
import { CHECK_CODE_CHARS, CHECK_CODE_EVEN, CHECK_CODE_ODD, MONTH_CODES, NUMERIC_POS, OMOCODIA_TABLE, OMOCODIA_TABLE_INVERSE } from './constants'
import { COMUNI } from './lista-comuni'
import { extractConsonants, extractVowels, getValidDate, birthplaceFields, getAllSubsets } from './utils'

class CodiceFiscale {
Expand Down Expand Up @@ -248,6 +249,7 @@ class CodiceFiscale {
};

CodiceFiscale.utils = {
birthplaceFields: birthplaceFields
birthplaceFields: birthplaceFields,
COMUNI: COMUNI
}
module.exports = CodiceFiscale;
module.exports = CodiceFiscale;
19 changes: 10 additions & 9 deletions tests/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,6 @@ describe('CodiceFiscale.check', () => {
})
})










describe("Il metodo toString()", ()=>{
test("funziona correttamente anche con le omocodie", ()=>{
let cf = new CodiceFiscale({
Expand All @@ -146,3 +137,13 @@ describe("Il metodo toString()", ()=>{

})
})

describe('CodiceFiscale.utils.COMUNI', () => {
test('è definito', () => {
expect(CodiceFiscale.utils.COMUNI).toBeDefined()
})

test('è un array con almeno un elemento', () => {
expect(CodiceFiscale.utils.COMUNI.length).toBeGreaterThan(1)
})
})
2 changes: 2 additions & 0 deletions types/codice-fiscale.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { COMUNI } from "../src/lista-comuni";
import { Comune } from "./comune";
import { birthplaceFields } from "./utils";

Expand Down Expand Up @@ -25,6 +26,7 @@ declare class CodiceFiscale {
readonly checkCode: string;
static utils: {
birthplaceFields: typeof birthplaceFields;
COMUNI: [string, string, string, 0|1][];
};
birthday: Date;
birthplace: Comune;
Expand Down