@flickfyi/flkr 0.0.141 → 0.0.146
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/node_modules/@flickfyi/attestation/.turbo/turbo-build.log +7 -7
- package/node_modules/@flickfyi/biscuit/.turbo/turbo-build.log +7 -7
- package/node_modules/@flickfyi/core/.oxlintrc.json +2 -1
- package/node_modules/@flickfyi/core/.turbo/turbo-build.log +502 -95
- package/node_modules/@flickfyi/core/README.md +58 -4
- package/node_modules/@flickfyi/core/dist/index.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/index.js +35 -24
- package/node_modules/@flickfyi/core/dist/kowalski/calculations.d.ts +17 -0
- package/node_modules/@flickfyi/core/dist/kowalski/calculator.d.ts +13 -0
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.cjs +1 -0
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.d.cts +962 -0
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.d.ts +962 -0
- package/node_modules/@flickfyi/core/dist/kowalski/catalog.js +639 -0
- package/node_modules/@flickfyi/core/dist/kowalski/clocks.d.ts +4 -0
- package/node_modules/@flickfyi/core/dist/kowalski/date-time.d.ts +22 -0
- package/node_modules/@flickfyi/core/dist/kowalski/details.d.ts +7 -0
- package/node_modules/@flickfyi/core/dist/kowalski/everyday.d.ts +8 -0
- package/node_modules/@flickfyi/core/dist/kowalski/format.d.ts +4 -0
- package/node_modules/@flickfyi/core/dist/kowalski/frame.d.ts +161 -0
- package/node_modules/@flickfyi/core/dist/kowalski/index.cjs +21 -0
- package/node_modules/@flickfyi/core/dist/kowalski/index.d.cts +8 -0
- package/node_modules/@flickfyi/core/dist/kowalski/index.d.ts +8 -0
- package/node_modules/@flickfyi/core/dist/kowalski/index.js +7496 -0
- package/node_modules/@flickfyi/core/dist/kowalski/productivity.d.ts +5 -0
- package/node_modules/@flickfyi/core/dist/kowalski/recipe.d.ts +8 -0
- package/node_modules/@flickfyi/core/dist/kowalski/tools.d.ts +7 -0
- package/node_modules/@flickfyi/core/dist/kowalski/use-clock.d.ts +6 -0
- package/node_modules/@flickfyi/core/dist/kowalski/use-configured-feature.d.ts +19 -0
- package/node_modules/@flickfyi/core/dist/kowalski/use-feature-store.d.ts +15 -0
- package/node_modules/@flickfyi/core/dist/kowalski.css +506 -0
- package/node_modules/@flickfyi/core/dist/molecules/field/field.d.ts +8 -0
- package/node_modules/@flickfyi/core/dist/molecules/index.cjs +1 -1
- package/node_modules/@flickfyi/core/dist/molecules/index.d.cts +3 -0
- package/node_modules/@flickfyi/core/dist/molecules/index.d.ts +3 -0
- package/node_modules/@flickfyi/core/dist/molecules/index.js +88 -27
- package/node_modules/@flickfyi/core/dist/molecules/segmented/segmented.d.ts +10 -0
- package/node_modules/@flickfyi/core/dist/molecules/stepper/stepper.d.ts +10 -0
- package/node_modules/@flickfyi/core/dist/quantum/use-store.d.ts +7 -1
- package/node_modules/@flickfyi/core/dist/themes.css +2 -0
- package/node_modules/@flickfyi/core/examples/kowalski/bill-split/bill-split.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/bill-split/bill-split.tsx +17 -0
- package/node_modules/@flickfyi/core/examples/kowalski/bookmark/bookmark.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/bookmark/bookmark.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/budget/budget.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/budget/budget.tsx +26 -0
- package/node_modules/@flickfyi/core/examples/kowalski/calculator/calculator.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/calculator/calculator.tsx +24 -0
- package/node_modules/@flickfyi/core/examples/kowalski/checklist/checklist.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/checklist/checklist.tsx +26 -0
- package/node_modules/@flickfyi/core/examples/kowalski/color-palette/color-palette.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/color-palette/color-palette.tsx +22 -0
- package/node_modules/@flickfyi/core/examples/kowalski/contact/contact.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/contact/contact.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/countdown/countdown.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/countdown/countdown.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/event/event.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/event/event.tsx +24 -0
- package/node_modules/@flickfyi/core/examples/kowalski/expense/expense.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/expense/expense.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/goal/goal.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/goal/goal.tsx +24 -0
- package/node_modules/@flickfyi/core/examples/kowalski/habit/habit.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/habit/habit.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/ledger/ledger.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/ledger/ledger.tsx +25 -0
- package/node_modules/@flickfyi/core/examples/kowalski/note/note.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/note/note.tsx +22 -0
- package/node_modules/@flickfyi/core/examples/kowalski/poll/poll.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/poll/poll.tsx +26 -0
- package/node_modules/@flickfyi/core/examples/kowalski/random-picker/random-picker.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/random-picker/random-picker.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/rating/rating.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/rating/rating.tsx +19 -0
- package/node_modules/@flickfyi/core/examples/kowalski/recipe/recipe.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/recipe/recipe.tsx +120 -0
- package/node_modules/@flickfyi/core/examples/kowalski/reminder/reminder.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/reminder/reminder.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/rotation/rotation.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/rotation/rotation.tsx +27 -0
- package/node_modules/@flickfyi/core/examples/kowalski/scoreboard/scoreboard.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/scoreboard/scoreboard.tsx +26 -0
- package/node_modules/@flickfyi/core/examples/kowalski/shopping-list/shopping-list.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/shopping-list/shopping-list.tsx +27 -0
- package/node_modules/@flickfyi/core/examples/kowalski/task-board/task-board.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/task-board/task-board.tsx +27 -0
- package/node_modules/@flickfyi/core/examples/kowalski/theme.ts +3 -0
- package/node_modules/@flickfyi/core/examples/kowalski/time-zone/time-zone.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/time-zone/time-zone.tsx +22 -0
- package/node_modules/@flickfyi/core/examples/kowalski/timer/timer.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/timer/timer.tsx +23 -0
- package/node_modules/@flickfyi/core/examples/kowalski/trip/trip.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/trip/trip.tsx +26 -0
- package/node_modules/@flickfyi/core/examples/kowalski/unit-converter/unit-converter.stories.tsx +15 -0
- package/node_modules/@flickfyi/core/examples/kowalski/unit-converter/unit-converter.tsx +24 -0
- package/node_modules/@flickfyi/core/examples/parrott/calculator/calculator.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/checklist/checklist.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/countdown/countdown.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/counter/counter.stories.tsx +1 -0
- package/node_modules/@flickfyi/core/examples/parrott/fortune/fortune.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/grid/grid.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/kale-smoothie/kale-smoothie.stories.tsx +1 -0
- package/node_modules/@flickfyi/core/examples/parrott/list/list.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/log/log.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/timed-task/timed-task.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/examples/parrott/timer/timer.stories.tsx +3 -1
- package/node_modules/@flickfyi/core/fixtures/native/host/project.yml +3 -0
- package/node_modules/@flickfyi/core/fixtures/native/src/catalog-features.tsx +88 -0
- package/node_modules/@flickfyi/core/package.json +35 -5
- package/node_modules/@flickfyi/core/package.tsgo.json +19 -1
- package/node_modules/@flickfyi/core/scripts/vite-globals.d.ts +2 -0
- package/node_modules/@flickfyi/core/src/generated-types.d.ts +1 -0
- package/node_modules/@flickfyi/core/src/kowalski/README.md +9 -0
- package/node_modules/@flickfyi/core/src/kowalski/calculations.ts +106 -0
- package/node_modules/@flickfyi/core/src/kowalski/calculator.ts +243 -0
- package/node_modules/@flickfyi/core/src/kowalski/catalog.ts +787 -0
- package/node_modules/@flickfyi/core/src/kowalski/clocks.tsx +464 -0
- package/node_modules/@flickfyi/core/src/kowalski/date-time.tsx +469 -0
- package/node_modules/@flickfyi/core/src/kowalski/details.tsx +1387 -0
- package/node_modules/@flickfyi/core/src/kowalski/everyday.tsx +652 -0
- package/node_modules/@flickfyi/core/src/kowalski/format.ts +48 -0
- package/node_modules/@flickfyi/core/src/kowalski/frame.tsx +351 -0
- package/node_modules/@flickfyi/core/src/kowalski/index.ts +23 -0
- package/node_modules/@flickfyi/core/src/kowalski/productivity.tsx +575 -0
- package/node_modules/@flickfyi/core/src/kowalski/recipe.tsx +555 -0
- package/node_modules/@flickfyi/core/src/kowalski/stories/composition.stories.tsx +47 -0
- package/node_modules/@flickfyi/core/src/kowalski/stories/composition.tsx +100 -0
- package/node_modules/@flickfyi/core/src/kowalski/tools.tsx +1213 -0
- package/node_modules/@flickfyi/core/src/kowalski/use-clock.ts +19 -0
- package/node_modules/@flickfyi/core/src/kowalski/use-configured-feature.ts +85 -0
- package/node_modules/@flickfyi/core/src/kowalski/use-feature-store.ts +119 -0
- package/node_modules/@flickfyi/core/src/molecules/field/field.tsx +34 -0
- package/node_modules/@flickfyi/core/src/molecules/index.ts +3 -0
- package/node_modules/@flickfyi/core/src/molecules/segmented/segmented.tsx +48 -0
- package/node_modules/@flickfyi/core/src/molecules/stepper/stepper.tsx +54 -0
- package/node_modules/@flickfyi/core/src/quantum/use-store.ts +41 -16
- package/node_modules/@flickfyi/core/tests/fly.test.ts +34 -7
- package/node_modules/@flickfyi/core/tests/kowalski-calculations.test.ts +60 -0
- package/node_modules/@flickfyi/core/tests/kowalski-calculator.test.ts +142 -0
- package/node_modules/@flickfyi/core/tests/kowalski-contracts.test.ts +223 -0
- package/node_modules/@flickfyi/core/tests/kowalski-date-time.test.tsx +462 -0
- package/node_modules/@flickfyi/core/tests/kowalski-features.test.tsx +2158 -0
- package/node_modules/@flickfyi/core/tests/kowalski-store.test.tsx +514 -0
- package/node_modules/@flickfyi/core/tests/preview-build.test.ts +1 -1
- package/node_modules/@flickfyi/core/tests/quantum-use-store.test.ts +53 -1
- package/node_modules/@flickfyi/core/tests/verify-tsgo-assets.test.ts +1 -1
- package/node_modules/@flickfyi/core/tsconfig.vite-dts.json +2 -1
- package/node_modules/@flickfyi/core/tsgo.bun.lock +111 -9
- package/node_modules/@flickfyi/core/tsgo.package.json +21 -3
- package/node_modules/@flickfyi/core/vite.config.ts +9 -5
- package/node_modules/@flickfyi/core/vitest.config.ts +1 -1
- package/node_modules/@flickfyi/http-message-sig/.turbo/turbo-build.log +7 -7
- package/node_modules/@flickfyi/identity/.turbo/turbo-build.log +8 -9
- package/node_modules/@flickfyi/lens/.turbo/turbo-build.log +7 -7
- package/node_modules/@flickfyi/photon/.turbo/turbo-build.log +10 -4
- package/node_modules/@flickfyi/photon/Sources/Photon/Components/Button.swift +29 -2
- package/node_modules/@flickfyi/photon/Sources/PhotonVersion/Resources/photon-version.json +1 -1
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Components/ButtonHostTests.swift +26 -0
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-features.styles.json +1 -0
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-native.styles.json +1 -1
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-scale.styles.json +1 -1
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-theme.styles.json +1 -1
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/catalog-typography.styles.json +1 -1
- package/node_modules/@flickfyi/photon/Tests/PhotonTests/Fixtures/StyleX/stylex-calculator.styles.json +1 -1
- package/node_modules/@flickfyi/photon/dist/globals.d.ts +5 -0
- package/node_modules/@flickfyi/photon/dist/version.cjs +1 -1
- package/node_modules/@flickfyi/photon/dist/version.js +1 -1
- package/node_modules/@flickfyi/photon/generated/react-swiftui.d.ts +1 -0
- package/node_modules/@flickfyi/photon/package.json +1 -1
- package/node_modules/@flickfyi/photon/src/globals.d.ts +5 -0
- package/node_modules/@flickfyi/rwsdk-extensions/.turbo/turbo-build.log +7 -7
- package/node_modules/@formatjs/fast-memoize/LICENSE.md +9 -0
- package/node_modules/@formatjs/fast-memoize/README.md +3 -0
- package/node_modules/@formatjs/fast-memoize/index.d.ts +35 -0
- package/node_modules/@formatjs/fast-memoize/index.js +69 -0
- package/node_modules/@formatjs/fast-memoize/index.js.map +1 -0
- package/node_modules/@formatjs/fast-memoize/package.json +25 -0
- package/node_modules/@formatjs/icu-messageformat-parser/LICENSE.md +9 -0
- package/node_modules/@formatjs/icu-messageformat-parser/README.md +38 -0
- package/node_modules/@formatjs/icu-messageformat-parser/index.d.ts +393 -0
- package/node_modules/@formatjs/icu-messageformat-parser/index.js +2187 -0
- package/node_modules/@formatjs/icu-messageformat-parser/index.js.map +1 -0
- package/node_modules/@formatjs/icu-messageformat-parser/manipulator.d.ts +175 -0
- package/node_modules/@formatjs/icu-messageformat-parser/manipulator.js +209 -0
- package/node_modules/@formatjs/icu-messageformat-parser/manipulator.js.map +1 -0
- package/node_modules/@formatjs/icu-messageformat-parser/no-parser.d.ts +183 -0
- package/node_modules/@formatjs/icu-messageformat-parser/no-parser.js +162 -0
- package/node_modules/@formatjs/icu-messageformat-parser/no-parser.js.map +1 -0
- package/node_modules/@formatjs/icu-messageformat-parser/package.json +21 -0
- package/node_modules/@formatjs/icu-messageformat-parser/printer.d.ts +154 -0
- package/node_modules/@formatjs/icu-messageformat-parser/printer.js +224 -0
- package/node_modules/@formatjs/icu-messageformat-parser/printer.js.map +1 -0
- package/node_modules/@formatjs/icu-skeleton-parser/LICENSE.md +9 -0
- package/node_modules/@formatjs/icu-skeleton-parser/README.md +1 -0
- package/node_modules/@formatjs/icu-skeleton-parser/index.d.ts +67 -0
- package/node_modules/@formatjs/icu-skeleton-parser/index.js +380 -0
- package/node_modules/@formatjs/icu-skeleton-parser/index.js.map +1 -0
- package/node_modules/@formatjs/icu-skeleton-parser/package.json +15 -0
- package/node_modules/@formatjs/intl/LICENSE.md +9 -0
- package/node_modules/@formatjs/intl/README.md +3 -0
- package/node_modules/@formatjs/intl/index.d.ts +499 -0
- package/node_modules/@formatjs/intl/index.js +595 -0
- package/node_modules/@formatjs/intl/index.js.map +1 -0
- package/node_modules/@formatjs/intl/package.json +37 -0
- package/node_modules/decimal.js/LICENCE.md +23 -0
- package/node_modules/decimal.js/README.md +246 -0
- package/node_modules/decimal.js/decimal.d.ts +301 -0
- package/node_modules/decimal.js/decimal.js +4951 -0
- package/node_modules/decimal.js/decimal.mjs +4914 -0
- package/node_modules/decimal.js/package.json +55 -0
- package/node_modules/format-quantity/LICENSE +21 -0
- package/node_modules/format-quantity/README.md +181 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.development.d.ts +131 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.development.js +214 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.development.js.map +1 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.production.d.ts +131 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.production.js +2 -0
- package/node_modules/format-quantity/dist/cjs/format-quantity.cjs.production.js.map +1 -0
- package/node_modules/format-quantity/dist/cjs/index.d.ts +1 -0
- package/node_modules/format-quantity/dist/cjs/index.js +6 -0
- package/node_modules/format-quantity/dist/format-quantity.d.mts +131 -0
- package/node_modules/format-quantity/dist/format-quantity.legacy-esm.d.ts +131 -0
- package/node_modules/format-quantity/dist/format-quantity.legacy-esm.js +268 -0
- package/node_modules/format-quantity/dist/format-quantity.legacy-esm.js.map +1 -0
- package/node_modules/format-quantity/dist/format-quantity.mjs +208 -0
- package/node_modules/format-quantity/dist/format-quantity.mjs.map +1 -0
- package/node_modules/format-quantity/dist/format-quantity.production.d.mts +131 -0
- package/node_modules/format-quantity/dist/format-quantity.production.mjs +2 -0
- package/node_modules/format-quantity/dist/format-quantity.production.mjs.map +1 -0
- package/node_modules/format-quantity/dist/format-quantity.umd.min.js +3 -0
- package/node_modules/format-quantity/dist/format-quantity.umd.min.js.map +1 -0
- package/node_modules/format-quantity/package.json +81 -0
- package/node_modules/intl-messageformat/LICENSE.md +33 -0
- package/node_modules/intl-messageformat/README.md +3 -0
- package/node_modules/intl-messageformat/index.d.ts +177 -0
- package/node_modules/intl-messageformat/index.js +327 -0
- package/node_modules/intl-messageformat/index.js.map +1 -0
- package/node_modules/intl-messageformat/intl-messageformat.iife.js +2819 -0
- package/node_modules/intl-messageformat/package.json +40 -0
- package/node_modules/numeric-quantity/LICENSE +21 -0
- package/node_modules/numeric-quantity/README.md +306 -0
- package/node_modules/numeric-quantity/dist/cjs/index.d.ts +1 -0
- package/node_modules/numeric-quantity/dist/cjs/index.js +6 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.development.d.ts +293 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.development.js +579 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.development.js.map +1 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.production.d.ts +293 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.production.js +2 -0
- package/node_modules/numeric-quantity/dist/cjs/numeric-quantity.cjs.production.js.map +1 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.d.mts +293 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.iife.umd.min.js +2 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.iife.umd.min.js.map +1 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.legacy-esm.d.ts +293 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.legacy-esm.js +622 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.legacy-esm.js.map +1 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.mjs +564 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.mjs.map +1 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.production.d.mts +293 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.production.mjs +2 -0
- package/node_modules/numeric-quantity/dist/numeric-quantity.production.mjs.map +1 -0
- package/node_modules/numeric-quantity/package.json +72 -0
- package/node_modules/validator/LICENSE +20 -0
- package/node_modules/validator/README.md +269 -0
- package/node_modules/validator/es/index.js +218 -0
- package/node_modules/validator/es/lib/alpha.js +151 -0
- package/node_modules/validator/es/lib/blacklist.js +5 -0
- package/node_modules/validator/es/lib/contains.js +15 -0
- package/node_modules/validator/es/lib/equals.js +5 -0
- package/node_modules/validator/es/lib/escape.js +5 -0
- package/node_modules/validator/es/lib/isAbaRouting.js +15 -0
- package/node_modules/validator/es/lib/isAfter.js +10 -0
- package/node_modules/validator/es/lib/isAlpha.js +23 -0
- package/node_modules/validator/es/lib/isAlphanumeric.js +23 -0
- package/node_modules/validator/es/lib/isAscii.js +10 -0
- package/node_modules/validator/es/lib/isBIC.js +16 -0
- package/node_modules/validator/es/lib/isBase32.js +15 -0
- package/node_modules/validator/es/lib/isBase58.js +8 -0
- package/node_modules/validator/es/lib/isBase64.js +23 -0
- package/node_modules/validator/es/lib/isBefore.js +10 -0
- package/node_modules/validator/es/lib/isBoolean.js +15 -0
- package/node_modules/validator/es/lib/isBtcAddress.js +7 -0
- package/node_modules/validator/es/lib/isByteLength.js +19 -0
- package/node_modules/validator/es/lib/isCreditCard.js +43 -0
- package/node_modules/validator/es/lib/isCurrency.js +74 -0
- package/node_modules/validator/es/lib/isDataURI.js +31 -0
- package/node_modules/validator/es/lib/isDate.js +93 -0
- package/node_modules/validator/es/lib/isDecimal.js +22 -0
- package/node_modules/validator/es/lib/isDivisibleBy.js +6 -0
- package/node_modules/validator/es/lib/isEAN.js +70 -0
- package/node_modules/validator/es/lib/isEmail.js +165 -0
- package/node_modules/validator/es/lib/isEmpty.js +10 -0
- package/node_modules/validator/es/lib/isEthereumAddress.js +6 -0
- package/node_modules/validator/es/lib/isFQDN.js +67 -0
- package/node_modules/validator/es/lib/isFloat.js +14 -0
- package/node_modules/validator/es/lib/isFullWidth.js +6 -0
- package/node_modules/validator/es/lib/isHSL.js +13 -0
- package/node_modules/validator/es/lib/isHalfWidth.js +6 -0
- package/node_modules/validator/es/lib/isHash.js +21 -0
- package/node_modules/validator/es/lib/isHexColor.js +13 -0
- package/node_modules/validator/es/lib/isHexadecimal.js +6 -0
- package/node_modules/validator/es/lib/isIBAN.js +171 -0
- package/node_modules/validator/es/lib/isIMEI.js +40 -0
- package/node_modules/validator/es/lib/isIP.js +58 -0
- package/node_modules/validator/es/lib/isIPRange.js +41 -0
- package/node_modules/validator/es/lib/isISBN.js +47 -0
- package/node_modules/validator/es/lib/isISIN.js +55 -0
- package/node_modules/validator/es/lib/isISO15924.js +9 -0
- package/node_modules/validator/es/lib/isISO31661Alpha2.js +21 -0
- package/node_modules/validator/es/lib/isISO31661Alpha3.js +20 -0
- package/node_modules/validator/es/lib/isISO31661Numeric.js +8 -0
- package/node_modules/validator/es/lib/isISO4217.js +9 -0
- package/node_modules/validator/es/lib/isISO6346.js +28 -0
- package/node_modules/validator/es/lib/isISO6391.js +6 -0
- package/node_modules/validator/es/lib/isISO8601.js +42 -0
- package/node_modules/validator/es/lib/isISRC.js +8 -0
- package/node_modules/validator/es/lib/isISSN.js +19 -0
- package/node_modules/validator/es/lib/isIdentityCard.js +407 -0
- package/node_modules/validator/es/lib/isIn.js +23 -0
- package/node_modules/validator/es/lib/isInt.js +19 -0
- package/node_modules/validator/es/lib/isJSON.js +26 -0
- package/node_modules/validator/es/lib/isJWT.js +15 -0
- package/node_modules/validator/es/lib/isLatLong.js +21 -0
- package/node_modules/validator/es/lib/isLength.js +27 -0
- package/node_modules/validator/es/lib/isLicensePlate.js +58 -0
- package/node_modules/validator/es/lib/isLocale.js +107 -0
- package/node_modules/validator/es/lib/isLowercase.js +5 -0
- package/node_modules/validator/es/lib/isLuhnNumber.js +25 -0
- package/node_modules/validator/es/lib/isMACAddress.js +36 -0
- package/node_modules/validator/es/lib/isMD5.js +6 -0
- package/node_modules/validator/es/lib/isMagnetURI.js +9 -0
- package/node_modules/validator/es/lib/isMailtoURI.js +75 -0
- package/node_modules/validator/es/lib/isMimeType.js +40 -0
- package/node_modules/validator/es/lib/isMobilePhone.js +212 -0
- package/node_modules/validator/es/lib/isMongoId.js +6 -0
- package/node_modules/validator/es/lib/isMultibyte.js +10 -0
- package/node_modules/validator/es/lib/isNumeric.js +10 -0
- package/node_modules/validator/es/lib/isOctal.js +6 -0
- package/node_modules/validator/es/lib/isPassportNumber.js +145 -0
- package/node_modules/validator/es/lib/isPort.js +8 -0
- package/node_modules/validator/es/lib/isPostalCode.js +100 -0
- package/node_modules/validator/es/lib/isRFC3339.js +21 -0
- package/node_modules/validator/es/lib/isRgbColor.js +34 -0
- package/node_modules/validator/es/lib/isSemVer.js +14 -0
- package/node_modules/validator/es/lib/isSlug.js +6 -0
- package/node_modules/validator/es/lib/isStrongPassword.js +90 -0
- package/node_modules/validator/es/lib/isSurrogatePair.js +6 -0
- package/node_modules/validator/es/lib/isTaxID.js +1407 -0
- package/node_modules/validator/es/lib/isTime.js +22 -0
- package/node_modules/validator/es/lib/isULID.js +5 -0
- package/node_modules/validator/es/lib/isURL.js +241 -0
- package/node_modules/validator/es/lib/isUUID.js +23 -0
- package/node_modules/validator/es/lib/isUppercase.js +5 -0
- package/node_modules/validator/es/lib/isVAT.js +264 -0
- package/node_modules/validator/es/lib/isVariableWidth.js +7 -0
- package/node_modules/validator/es/lib/isWhitelisted.js +10 -0
- package/node_modules/validator/es/lib/ltrim.js +7 -0
- package/node_modules/validator/es/lib/matches.js +8 -0
- package/node_modules/validator/es/lib/normalizeEmail.js +131 -0
- package/node_modules/validator/es/lib/rtrim.js +15 -0
- package/node_modules/validator/es/lib/stripLow.js +7 -0
- package/node_modules/validator/es/lib/toBoolean.js +8 -0
- package/node_modules/validator/es/lib/toDate.js +6 -0
- package/node_modules/validator/es/lib/toFloat.js +5 -0
- package/node_modules/validator/es/lib/toInt.js +5 -0
- package/node_modules/validator/es/lib/trim.js +5 -0
- package/node_modules/validator/es/lib/unescape.js +8 -0
- package/node_modules/validator/es/lib/util/algorithms.js +79 -0
- package/node_modules/validator/es/lib/util/assertString.js +4 -0
- package/node_modules/validator/es/lib/util/checkHost.js +12 -0
- package/node_modules/validator/es/lib/util/includesArray.js +6 -0
- package/node_modules/validator/es/lib/util/includesString.js +4 -0
- package/node_modules/validator/es/lib/util/merge.js +14 -0
- package/node_modules/validator/es/lib/util/multilineRegex.js +12 -0
- package/node_modules/validator/es/lib/util/nullUndefinedCheck.js +3 -0
- package/node_modules/validator/es/lib/util/toString.js +13 -0
- package/node_modules/validator/es/lib/util/typeOf.js +10 -0
- package/node_modules/validator/es/lib/whitelist.js +5 -0
- package/node_modules/validator/index.js +229 -0
- package/node_modules/validator/lib/alpha.js +157 -0
- package/node_modules/validator/lib/blacklist.js +14 -0
- package/node_modules/validator/lib/contains.js +24 -0
- package/node_modules/validator/lib/equals.js +14 -0
- package/node_modules/validator/lib/escape.js +14 -0
- package/node_modules/validator/lib/isAbaRouting.js +23 -0
- package/node_modules/validator/lib/isAfter.js +19 -0
- package/node_modules/validator/lib/isAlpha.js +31 -0
- package/node_modules/validator/lib/isAlphanumeric.js +31 -0
- package/node_modules/validator/lib/isAscii.js +18 -0
- package/node_modules/validator/lib/isBIC.js +24 -0
- package/node_modules/validator/lib/isBase32.js +24 -0
- package/node_modules/validator/lib/isBase58.js +16 -0
- package/node_modules/validator/lib/isBase64.js +32 -0
- package/node_modules/validator/lib/isBefore.js +19 -0
- package/node_modules/validator/lib/isBoolean.js +24 -0
- package/node_modules/validator/lib/isBtcAddress.js +16 -0
- package/node_modules/validator/lib/isByteLength.js +27 -0
- package/node_modules/validator/lib/isCreditCard.js +52 -0
- package/node_modules/validator/lib/isCurrency.js +83 -0
- package/node_modules/validator/lib/isDataURI.js +40 -0
- package/node_modules/validator/lib/isDate.js +102 -0
- package/node_modules/validator/lib/isDecimal.js +31 -0
- package/node_modules/validator/lib/isDivisibleBy.js +15 -0
- package/node_modules/validator/lib/isEAN.js +78 -0
- package/node_modules/validator/lib/isEmail.js +174 -0
- package/node_modules/validator/lib/isEmpty.js +19 -0
- package/node_modules/validator/lib/isEthereumAddress.js +15 -0
- package/node_modules/validator/lib/isFQDN.js +76 -0
- package/node_modules/validator/lib/isFloat.js +22 -0
- package/node_modules/validator/lib/isFullWidth.js +14 -0
- package/node_modules/validator/lib/isHSL.js +22 -0
- package/node_modules/validator/lib/isHalfWidth.js +14 -0
- package/node_modules/validator/lib/isHash.js +30 -0
- package/node_modules/validator/lib/isHexColor.js +22 -0
- package/node_modules/validator/lib/isHexadecimal.js +15 -0
- package/node_modules/validator/lib/isIBAN.js +178 -0
- package/node_modules/validator/lib/isIMEI.js +49 -0
- package/node_modules/validator/lib/isIP.js +67 -0
- package/node_modules/validator/lib/isIPRange.js +50 -0
- package/node_modules/validator/lib/isISBN.js +56 -0
- package/node_modules/validator/lib/isISIN.js +64 -0
- package/node_modules/validator/lib/isISO15924.js +16 -0
- package/node_modules/validator/lib/isISO31661Alpha2.js +28 -0
- package/node_modules/validator/lib/isISO31661Alpha3.js +28 -0
- package/node_modules/validator/lib/isISO31661Numeric.js +16 -0
- package/node_modules/validator/lib/isISO4217.js +16 -0
- package/node_modules/validator/lib/isISO6346.js +35 -0
- package/node_modules/validator/lib/isISO6391.js +15 -0
- package/node_modules/validator/lib/isISO8601.js +50 -0
- package/node_modules/validator/lib/isISRC.js +16 -0
- package/node_modules/validator/lib/isISSN.js +28 -0
- package/node_modules/validator/lib/isIdentityCard.js +416 -0
- package/node_modules/validator/lib/isIn.js +32 -0
- package/node_modules/validator/lib/isInt.js +28 -0
- package/node_modules/validator/lib/isJSON.js +35 -0
- package/node_modules/validator/lib/isJWT.js +24 -0
- package/node_modules/validator/lib/isLatLong.js +30 -0
- package/node_modules/validator/lib/isLength.js +35 -0
- package/node_modules/validator/lib/isLicensePlate.js +67 -0
- package/node_modules/validator/lib/isLocale.js +115 -0
- package/node_modules/validator/lib/isLowercase.js +14 -0
- package/node_modules/validator/lib/isLuhnNumber.js +34 -0
- package/node_modules/validator/lib/isMACAddress.js +45 -0
- package/node_modules/validator/lib/isMD5.js +15 -0
- package/node_modules/validator/lib/isMagnetURI.js +18 -0
- package/node_modules/validator/lib/isMailtoURI.js +84 -0
- package/node_modules/validator/lib/isMimeType.js +48 -0
- package/node_modules/validator/lib/isMobilePhone.js +219 -0
- package/node_modules/validator/lib/isMongoId.js +15 -0
- package/node_modules/validator/lib/isMultibyte.js +18 -0
- package/node_modules/validator/lib/isNumeric.js +19 -0
- package/node_modules/validator/lib/isOctal.js +15 -0
- package/node_modules/validator/lib/isPassportNumber.js +152 -0
- package/node_modules/validator/lib/isPort.js +17 -0
- package/node_modules/validator/lib/isPostalCode.js +107 -0
- package/node_modules/validator/lib/isRFC3339.js +29 -0
- package/node_modules/validator/lib/isRgbColor.js +42 -0
- package/node_modules/validator/lib/isSemVer.js +22 -0
- package/node_modules/validator/lib/isSlug.js +15 -0
- package/node_modules/validator/lib/isStrongPassword.js +99 -0
- package/node_modules/validator/lib/isSurrogatePair.js +15 -0
- package/node_modules/validator/lib/isTaxID.js +1417 -0
- package/node_modules/validator/lib/isTime.js +31 -0
- package/node_modules/validator/lib/isULID.js +14 -0
- package/node_modules/validator/lib/isURL.js +249 -0
- package/node_modules/validator/lib/isUUID.js +32 -0
- package/node_modules/validator/lib/isUppercase.js +14 -0
- package/node_modules/validator/lib/isVAT.js +274 -0
- package/node_modules/validator/lib/isVariableWidth.js +16 -0
- package/node_modules/validator/lib/isWhitelisted.js +19 -0
- package/node_modules/validator/lib/ltrim.js +16 -0
- package/node_modules/validator/lib/matches.js +17 -0
- package/node_modules/validator/lib/normalizeEmail.js +140 -0
- package/node_modules/validator/lib/rtrim.js +24 -0
- package/node_modules/validator/lib/stripLow.js +16 -0
- package/node_modules/validator/lib/toBoolean.js +17 -0
- package/node_modules/validator/lib/toDate.js +15 -0
- package/node_modules/validator/lib/toFloat.js +14 -0
- package/node_modules/validator/lib/toInt.js +14 -0
- package/node_modules/validator/lib/trim.js +14 -0
- package/node_modules/validator/lib/unescape.js +17 -0
- package/node_modules/validator/lib/util/algorithms.js +88 -0
- package/node_modules/validator/lib/util/assertString.js +12 -0
- package/node_modules/validator/lib/util/checkHost.js +20 -0
- package/node_modules/validator/lib/util/includesArray.js +14 -0
- package/node_modules/validator/lib/util/includesString.js +12 -0
- package/node_modules/validator/lib/util/merge.js +22 -0
- package/node_modules/validator/lib/util/multilineRegex.js +20 -0
- package/node_modules/validator/lib/util/nullUndefinedCheck.js +11 -0
- package/node_modules/validator/lib/util/toString.js +21 -0
- package/node_modules/validator/lib/util/typeOf.js +18 -0
- package/node_modules/validator/lib/whitelist.js +14 -0
- package/node_modules/validator/package.json +76 -0
- package/node_modules/validator/validator.js +5808 -0
- package/node_modules/validator/validator.min.js +23 -0
- package/package.json +3 -3
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
import assertString from './util/assertString';
|
|
2
|
+
import includes from './util/includesArray';
|
|
3
|
+
import isInt from './isInt';
|
|
4
|
+
var validators = {
|
|
5
|
+
PL: function PL(str) {
|
|
6
|
+
assertString(str);
|
|
7
|
+
var weightOfDigits = {
|
|
8
|
+
1: 1,
|
|
9
|
+
2: 3,
|
|
10
|
+
3: 7,
|
|
11
|
+
4: 9,
|
|
12
|
+
5: 1,
|
|
13
|
+
6: 3,
|
|
14
|
+
7: 7,
|
|
15
|
+
8: 9,
|
|
16
|
+
9: 1,
|
|
17
|
+
10: 3,
|
|
18
|
+
11: 0
|
|
19
|
+
};
|
|
20
|
+
if (str != null && str.length === 11 && isInt(str, {
|
|
21
|
+
allow_leading_zeroes: true
|
|
22
|
+
})) {
|
|
23
|
+
var digits = str.split('').slice(0, -1);
|
|
24
|
+
var sum = digits.reduce(function (acc, digit, index) {
|
|
25
|
+
return acc + Number(digit) * weightOfDigits[index + 1];
|
|
26
|
+
}, 0);
|
|
27
|
+
var modulo = sum % 10;
|
|
28
|
+
var lastDigit = Number(str.charAt(str.length - 1));
|
|
29
|
+
if (modulo === 0 && lastDigit === 0 || lastDigit === 10 - modulo) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
34
|
+
},
|
|
35
|
+
ES: function ES(str) {
|
|
36
|
+
assertString(str);
|
|
37
|
+
var DNI = /^[0-9X-Z][0-9]{7}[TRWAGMYFPDXBNJZSQVHLCKE]$/;
|
|
38
|
+
var charsValue = {
|
|
39
|
+
X: 0,
|
|
40
|
+
Y: 1,
|
|
41
|
+
Z: 2
|
|
42
|
+
};
|
|
43
|
+
var controlDigits = ['T', 'R', 'W', 'A', 'G', 'M', 'Y', 'F', 'P', 'D', 'X', 'B', 'N', 'J', 'Z', 'S', 'Q', 'V', 'H', 'L', 'C', 'K', 'E'];
|
|
44
|
+
|
|
45
|
+
// sanitize user input
|
|
46
|
+
var sanitized = str.trim().toUpperCase();
|
|
47
|
+
|
|
48
|
+
// validate the data structure
|
|
49
|
+
if (!DNI.test(sanitized)) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// validate the control digit
|
|
54
|
+
var number = sanitized.slice(0, -1).replace(/[X,Y,Z]/g, function (_char) {
|
|
55
|
+
return charsValue[_char];
|
|
56
|
+
});
|
|
57
|
+
return sanitized.endsWith(controlDigits[number % 23]);
|
|
58
|
+
},
|
|
59
|
+
FI: function FI(str) {
|
|
60
|
+
// https://dvv.fi/en/personal-identity-code#:~:text=control%20character%20for%20a-,personal,-identity%20code%20calculated
|
|
61
|
+
assertString(str);
|
|
62
|
+
if (str.length !== 11) {
|
|
63
|
+
return false;
|
|
64
|
+
}
|
|
65
|
+
if (!str.match(/^\d{6}[\-A\+]\d{3}[0-9ABCDEFHJKLMNPRSTUVWXY]{1}$/)) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
var checkDigits = '0123456789ABCDEFHJKLMNPRSTUVWXY';
|
|
69
|
+
var idAsNumber = parseInt(str.slice(0, 6), 10) * 1000 + parseInt(str.slice(7, 10), 10);
|
|
70
|
+
var remainder = idAsNumber % 31;
|
|
71
|
+
var checkDigit = checkDigits[remainder];
|
|
72
|
+
return checkDigit === str.slice(10, 11);
|
|
73
|
+
},
|
|
74
|
+
IN: function IN(str) {
|
|
75
|
+
var DNI = /^[1-9]\d{3}\s?\d{4}\s?\d{4}$/;
|
|
76
|
+
|
|
77
|
+
// multiplication table
|
|
78
|
+
var d = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 0, 6, 7, 8, 9, 5], [2, 3, 4, 0, 1, 7, 8, 9, 5, 6], [3, 4, 0, 1, 2, 8, 9, 5, 6, 7], [4, 0, 1, 2, 3, 9, 5, 6, 7, 8], [5, 9, 8, 7, 6, 0, 4, 3, 2, 1], [6, 5, 9, 8, 7, 1, 0, 4, 3, 2], [7, 6, 5, 9, 8, 2, 1, 0, 4, 3], [8, 7, 6, 5, 9, 3, 2, 1, 0, 4], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]];
|
|
79
|
+
|
|
80
|
+
// permutation table
|
|
81
|
+
var p = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 5, 7, 6, 2, 8, 3, 0, 9, 4], [5, 8, 0, 3, 7, 9, 6, 1, 4, 2], [8, 9, 1, 6, 0, 4, 3, 5, 2, 7], [9, 4, 5, 3, 1, 2, 6, 8, 7, 0], [4, 2, 8, 6, 5, 7, 3, 9, 0, 1], [2, 7, 9, 3, 8, 0, 6, 4, 1, 5], [7, 0, 4, 6, 9, 1, 3, 2, 5, 8]];
|
|
82
|
+
|
|
83
|
+
// sanitize user input
|
|
84
|
+
var sanitized = str.trim();
|
|
85
|
+
|
|
86
|
+
// validate the data structure
|
|
87
|
+
if (!DNI.test(sanitized)) {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
var c = 0;
|
|
91
|
+
var invertedArray = sanitized.replace(/\s/g, '').split('').map(Number).reverse();
|
|
92
|
+
invertedArray.forEach(function (val, i) {
|
|
93
|
+
c = d[c][p[i % 8][val]];
|
|
94
|
+
});
|
|
95
|
+
return c === 0;
|
|
96
|
+
},
|
|
97
|
+
IR: function IR(str) {
|
|
98
|
+
if (!str.match(/^\d{10}$/)) return false;
|
|
99
|
+
str = "0000".concat(str).slice(str.length - 6);
|
|
100
|
+
if (parseInt(str.slice(3, 9), 10) === 0) return false;
|
|
101
|
+
var lastNumber = parseInt(str.slice(9, 10), 10);
|
|
102
|
+
var sum = 0;
|
|
103
|
+
for (var i = 0; i < 9; i++) {
|
|
104
|
+
sum += parseInt(str.slice(i, i + 1), 10) * (10 - i);
|
|
105
|
+
}
|
|
106
|
+
sum %= 11;
|
|
107
|
+
return sum < 2 && lastNumber === sum || sum >= 2 && lastNumber === 11 - sum;
|
|
108
|
+
},
|
|
109
|
+
IT: function IT(str) {
|
|
110
|
+
if (str.length !== 9) return false;
|
|
111
|
+
if (str === 'CA00000AA') return false; // https://it.wikipedia.org/wiki/Carta_d%27identit%C3%A0_elettronica_italiana
|
|
112
|
+
return str.search(/C[A-Z]\d{5}[A-Z]{2}/i) > -1;
|
|
113
|
+
},
|
|
114
|
+
NO: function NO(str) {
|
|
115
|
+
var sanitized = str.trim();
|
|
116
|
+
if (isNaN(Number(sanitized))) return false;
|
|
117
|
+
if (sanitized.length !== 11) return false;
|
|
118
|
+
if (sanitized === '00000000000') return false;
|
|
119
|
+
|
|
120
|
+
// https://no.wikipedia.org/wiki/F%C3%B8dselsnummer
|
|
121
|
+
var f = sanitized.split('').map(Number);
|
|
122
|
+
var k1 = (11 - (3 * f[0] + 7 * f[1] + 6 * f[2] + 1 * f[3] + 8 * f[4] + 9 * f[5] + 4 * f[6] + 5 * f[7] + 2 * f[8]) % 11) % 11;
|
|
123
|
+
var k2 = (11 - (5 * f[0] + 4 * f[1] + 3 * f[2] + 2 * f[3] + 7 * f[4] + 6 * f[5] + 5 * f[6] + 4 * f[7] + 3 * f[8] + 2 * k1) % 11) % 11;
|
|
124
|
+
if (k1 !== f[9] || k2 !== f[10]) return false;
|
|
125
|
+
return true;
|
|
126
|
+
},
|
|
127
|
+
TH: function TH(str) {
|
|
128
|
+
if (!str.match(/^[1-8]\d{12}$/)) return false;
|
|
129
|
+
|
|
130
|
+
// validate check digit
|
|
131
|
+
var sum = 0;
|
|
132
|
+
for (var i = 0; i < 12; i++) {
|
|
133
|
+
sum += parseInt(str[i], 10) * (13 - i);
|
|
134
|
+
}
|
|
135
|
+
return str[12] === ((11 - sum % 11) % 10).toString();
|
|
136
|
+
},
|
|
137
|
+
LK: function LK(str) {
|
|
138
|
+
var old_nic = /^[1-9]\d{8}[vx]$/i;
|
|
139
|
+
var new_nic = /^[1-9]\d{11}$/i;
|
|
140
|
+
if (str.length === 10 && old_nic.test(str)) return true;else if (str.length === 12 && new_nic.test(str)) return true;
|
|
141
|
+
return false;
|
|
142
|
+
},
|
|
143
|
+
'he-IL': function heIL(str) {
|
|
144
|
+
var DNI = /^\d{9}$/;
|
|
145
|
+
|
|
146
|
+
// sanitize user input
|
|
147
|
+
var sanitized = str.trim();
|
|
148
|
+
|
|
149
|
+
// validate the data structure
|
|
150
|
+
if (!DNI.test(sanitized)) {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
var id = sanitized;
|
|
154
|
+
var sum = 0,
|
|
155
|
+
incNum;
|
|
156
|
+
for (var i = 0; i < id.length; i++) {
|
|
157
|
+
incNum = Number(id[i]) * (i % 2 + 1); // Multiply number by 1 or 2
|
|
158
|
+
sum += incNum > 9 ? incNum - 9 : incNum; // Sum the digits up and add to total
|
|
159
|
+
}
|
|
160
|
+
return sum % 10 === 0;
|
|
161
|
+
},
|
|
162
|
+
'ar-LY': function arLY(str) {
|
|
163
|
+
// Libya National Identity Number NIN is 12 digits, the first digit is either 1 or 2
|
|
164
|
+
var NIN = /^(1|2)\d{11}$/;
|
|
165
|
+
|
|
166
|
+
// sanitize user input
|
|
167
|
+
var sanitized = str.trim();
|
|
168
|
+
return NIN.test(sanitized);
|
|
169
|
+
},
|
|
170
|
+
'ar-TN': function arTN(str) {
|
|
171
|
+
var DNI = /^\d{8}$/;
|
|
172
|
+
|
|
173
|
+
// sanitize user input
|
|
174
|
+
var sanitized = str.trim();
|
|
175
|
+
return DNI.test(sanitized);
|
|
176
|
+
},
|
|
177
|
+
'zh-CN': function zhCN(str) {
|
|
178
|
+
var provincesAndCities = ['11',
|
|
179
|
+
// 北京
|
|
180
|
+
'12',
|
|
181
|
+
// 天津
|
|
182
|
+
'13',
|
|
183
|
+
// 河北
|
|
184
|
+
'14',
|
|
185
|
+
// 山西
|
|
186
|
+
'15',
|
|
187
|
+
// 内蒙古
|
|
188
|
+
'21',
|
|
189
|
+
// 辽宁
|
|
190
|
+
'22',
|
|
191
|
+
// 吉林
|
|
192
|
+
'23',
|
|
193
|
+
// 黑龙江
|
|
194
|
+
'31',
|
|
195
|
+
// 上海
|
|
196
|
+
'32',
|
|
197
|
+
// 江苏
|
|
198
|
+
'33',
|
|
199
|
+
// 浙江
|
|
200
|
+
'34',
|
|
201
|
+
// 安徽
|
|
202
|
+
'35',
|
|
203
|
+
// 福建
|
|
204
|
+
'36',
|
|
205
|
+
// 江西
|
|
206
|
+
'37',
|
|
207
|
+
// 山东
|
|
208
|
+
'41',
|
|
209
|
+
// 河南
|
|
210
|
+
'42',
|
|
211
|
+
// 湖北
|
|
212
|
+
'43',
|
|
213
|
+
// 湖南
|
|
214
|
+
'44',
|
|
215
|
+
// 广东
|
|
216
|
+
'45',
|
|
217
|
+
// 广西
|
|
218
|
+
'46',
|
|
219
|
+
// 海南
|
|
220
|
+
'50',
|
|
221
|
+
// 重庆
|
|
222
|
+
'51',
|
|
223
|
+
// 四川
|
|
224
|
+
'52',
|
|
225
|
+
// 贵州
|
|
226
|
+
'53',
|
|
227
|
+
// 云南
|
|
228
|
+
'54',
|
|
229
|
+
// 西藏
|
|
230
|
+
'61',
|
|
231
|
+
// 陕西
|
|
232
|
+
'62',
|
|
233
|
+
// 甘肃
|
|
234
|
+
'63',
|
|
235
|
+
// 青海
|
|
236
|
+
'64',
|
|
237
|
+
// 宁夏
|
|
238
|
+
'65',
|
|
239
|
+
// 新疆
|
|
240
|
+
'71',
|
|
241
|
+
// 台湾
|
|
242
|
+
'81',
|
|
243
|
+
// 香港
|
|
244
|
+
'82',
|
|
245
|
+
// 澳门
|
|
246
|
+
'91' // 国外
|
|
247
|
+
];
|
|
248
|
+
var powers = ['7', '9', '10', '5', '8', '4', '2', '1', '6', '3', '7', '9', '10', '5', '8', '4', '2'];
|
|
249
|
+
var parityBit = ['1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2'];
|
|
250
|
+
var checkAddressCode = function checkAddressCode(addressCode) {
|
|
251
|
+
return includes(provincesAndCities, addressCode);
|
|
252
|
+
};
|
|
253
|
+
var checkBirthDayCode = function checkBirthDayCode(birDayCode) {
|
|
254
|
+
var yyyy = parseInt(birDayCode.substring(0, 4), 10);
|
|
255
|
+
var mm = parseInt(birDayCode.substring(4, 6), 10);
|
|
256
|
+
var dd = parseInt(birDayCode.substring(6), 10);
|
|
257
|
+
var xdata = new Date(yyyy, mm - 1, dd);
|
|
258
|
+
if (xdata > new Date()) {
|
|
259
|
+
return false;
|
|
260
|
+
// eslint-disable-next-line max-len
|
|
261
|
+
} else if (xdata.getFullYear() === yyyy && xdata.getMonth() === mm - 1 && xdata.getDate() === dd) {
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
return false;
|
|
265
|
+
};
|
|
266
|
+
var getParityBit = function getParityBit(idCardNo) {
|
|
267
|
+
var id17 = idCardNo.substring(0, 17);
|
|
268
|
+
var power = 0;
|
|
269
|
+
for (var i = 0; i < 17; i++) {
|
|
270
|
+
power += parseInt(id17.charAt(i), 10) * parseInt(powers[i], 10);
|
|
271
|
+
}
|
|
272
|
+
var mod = power % 11;
|
|
273
|
+
return parityBit[mod];
|
|
274
|
+
};
|
|
275
|
+
var checkParityBit = function checkParityBit(idCardNo) {
|
|
276
|
+
return getParityBit(idCardNo) === idCardNo.charAt(17).toUpperCase();
|
|
277
|
+
};
|
|
278
|
+
var check15IdCardNo = function check15IdCardNo(idCardNo) {
|
|
279
|
+
var check = /^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(idCardNo);
|
|
280
|
+
if (!check) return false;
|
|
281
|
+
var addressCode = idCardNo.substring(0, 2);
|
|
282
|
+
check = checkAddressCode(addressCode);
|
|
283
|
+
if (!check) return false;
|
|
284
|
+
var birDayCode = "19".concat(idCardNo.substring(6, 12));
|
|
285
|
+
check = checkBirthDayCode(birDayCode);
|
|
286
|
+
if (!check) return false;
|
|
287
|
+
return true;
|
|
288
|
+
};
|
|
289
|
+
var check18IdCardNo = function check18IdCardNo(idCardNo) {
|
|
290
|
+
var check = /^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test(idCardNo);
|
|
291
|
+
if (!check) return false;
|
|
292
|
+
var addressCode = idCardNo.substring(0, 2);
|
|
293
|
+
check = checkAddressCode(addressCode);
|
|
294
|
+
if (!check) return false;
|
|
295
|
+
var birDayCode = idCardNo.substring(6, 14);
|
|
296
|
+
check = checkBirthDayCode(birDayCode);
|
|
297
|
+
if (!check) return false;
|
|
298
|
+
return checkParityBit(idCardNo);
|
|
299
|
+
};
|
|
300
|
+
var checkIdCardNo = function checkIdCardNo(idCardNo) {
|
|
301
|
+
var check = /^\d{15}|(\d{17}(\d|x|X))$/.test(idCardNo);
|
|
302
|
+
if (!check) return false;
|
|
303
|
+
if (idCardNo.length === 15) {
|
|
304
|
+
return check15IdCardNo(idCardNo);
|
|
305
|
+
}
|
|
306
|
+
return check18IdCardNo(idCardNo);
|
|
307
|
+
};
|
|
308
|
+
return checkIdCardNo(str);
|
|
309
|
+
},
|
|
310
|
+
'zh-HK': function zhHK(str) {
|
|
311
|
+
// sanitize user input
|
|
312
|
+
str = str.trim();
|
|
313
|
+
|
|
314
|
+
// HKID number starts with 1 or 2 letters, followed by 6 digits,
|
|
315
|
+
// then a checksum contained in square / round brackets or nothing
|
|
316
|
+
var regexHKID = /^[A-Z]{1,2}[0-9]{6}((\([0-9A]\))|(\[[0-9A]\])|([0-9A]))$/;
|
|
317
|
+
var regexIsDigit = /^[0-9]$/;
|
|
318
|
+
|
|
319
|
+
// convert the user input to all uppercase and apply regex
|
|
320
|
+
str = str.toUpperCase();
|
|
321
|
+
if (!regexHKID.test(str)) return false;
|
|
322
|
+
str = str.replace(/\[|\]|\(|\)/g, '');
|
|
323
|
+
if (str.length === 8) str = "3".concat(str);
|
|
324
|
+
var checkSumVal = 0;
|
|
325
|
+
for (var i = 0; i <= 7; i++) {
|
|
326
|
+
var convertedChar = void 0;
|
|
327
|
+
if (!regexIsDigit.test(str[i])) convertedChar = (str[i].charCodeAt(0) - 55) % 11;else convertedChar = str[i];
|
|
328
|
+
checkSumVal += convertedChar * (9 - i);
|
|
329
|
+
}
|
|
330
|
+
checkSumVal %= 11;
|
|
331
|
+
var checkSumConverted;
|
|
332
|
+
if (checkSumVal === 0) checkSumConverted = '0';else if (checkSumVal === 1) checkSumConverted = 'A';else checkSumConverted = String(11 - checkSumVal);
|
|
333
|
+
if (checkSumConverted === str[str.length - 1]) return true;
|
|
334
|
+
return false;
|
|
335
|
+
},
|
|
336
|
+
'zh-TW': function zhTW(str) {
|
|
337
|
+
var ALPHABET_CODES = {
|
|
338
|
+
A: 10,
|
|
339
|
+
B: 11,
|
|
340
|
+
C: 12,
|
|
341
|
+
D: 13,
|
|
342
|
+
E: 14,
|
|
343
|
+
F: 15,
|
|
344
|
+
G: 16,
|
|
345
|
+
H: 17,
|
|
346
|
+
I: 34,
|
|
347
|
+
J: 18,
|
|
348
|
+
K: 19,
|
|
349
|
+
L: 20,
|
|
350
|
+
M: 21,
|
|
351
|
+
N: 22,
|
|
352
|
+
O: 35,
|
|
353
|
+
P: 23,
|
|
354
|
+
Q: 24,
|
|
355
|
+
R: 25,
|
|
356
|
+
S: 26,
|
|
357
|
+
T: 27,
|
|
358
|
+
U: 28,
|
|
359
|
+
V: 29,
|
|
360
|
+
W: 32,
|
|
361
|
+
X: 30,
|
|
362
|
+
Y: 31,
|
|
363
|
+
Z: 33
|
|
364
|
+
};
|
|
365
|
+
var sanitized = str.trim().toUpperCase();
|
|
366
|
+
if (!/^[A-Z][0-9]{9}$/.test(sanitized)) return false;
|
|
367
|
+
return Array.from(sanitized).reduce(function (sum, number, index) {
|
|
368
|
+
if (index === 0) {
|
|
369
|
+
var code = ALPHABET_CODES[number];
|
|
370
|
+
return code % 10 * 9 + Math.floor(code / 10);
|
|
371
|
+
}
|
|
372
|
+
if (index === 9) {
|
|
373
|
+
return (10 - sum % 10 - Number(number)) % 10 === 0;
|
|
374
|
+
}
|
|
375
|
+
return sum + Number(number) * (9 - index);
|
|
376
|
+
}, 0);
|
|
377
|
+
},
|
|
378
|
+
PK: function PK(str) {
|
|
379
|
+
// Pakistani National Identity Number CNIC is 13 digits
|
|
380
|
+
var CNIC = /^[1-7][0-9]{4}-[0-9]{7}-[1-9]$/;
|
|
381
|
+
|
|
382
|
+
// sanitize user input
|
|
383
|
+
var sanitized = str.trim();
|
|
384
|
+
|
|
385
|
+
// validate the data structure
|
|
386
|
+
return CNIC.test(sanitized);
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
export default function isIdentityCard(str, locale) {
|
|
390
|
+
assertString(str);
|
|
391
|
+
if (locale in validators) {
|
|
392
|
+
return validators[locale](str);
|
|
393
|
+
} else if (locale === 'any') {
|
|
394
|
+
for (var key in validators) {
|
|
395
|
+
// https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes
|
|
396
|
+
// istanbul ignore else
|
|
397
|
+
if (validators.hasOwnProperty(key)) {
|
|
398
|
+
var validator = validators[key];
|
|
399
|
+
if (validator(str)) {
|
|
400
|
+
return true;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
return false;
|
|
405
|
+
}
|
|
406
|
+
throw new Error("Invalid locale '".concat(locale, "'"));
|
|
407
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
import assertString from './util/assertString';
|
|
3
|
+
import toString from './util/toString';
|
|
4
|
+
export default function isIn(str, options) {
|
|
5
|
+
assertString(str);
|
|
6
|
+
var i;
|
|
7
|
+
if (Object.prototype.toString.call(options) === '[object Array]') {
|
|
8
|
+
var array = [];
|
|
9
|
+
for (i in options) {
|
|
10
|
+
// https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes
|
|
11
|
+
// istanbul ignore else
|
|
12
|
+
if ({}.hasOwnProperty.call(options, i)) {
|
|
13
|
+
array[i] = toString(options[i]);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return array.indexOf(str) >= 0;
|
|
17
|
+
} else if (_typeof(options) === 'object') {
|
|
18
|
+
return options.hasOwnProperty(str);
|
|
19
|
+
} else if (options && typeof options.indexOf === 'function') {
|
|
20
|
+
return options.indexOf(str) >= 0;
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import assertString from './util/assertString';
|
|
2
|
+
import isNullOrUndefined from './util/nullUndefinedCheck';
|
|
3
|
+
var _int = /^(?:[-+]?(?:0|[1-9][0-9]*))$/;
|
|
4
|
+
var intLeadingZeroes = /^[-+]?[0-9]+$/;
|
|
5
|
+
export default function isInt(str, options) {
|
|
6
|
+
assertString(str);
|
|
7
|
+
options = options || {};
|
|
8
|
+
|
|
9
|
+
// Get the regex to use for testing, based on whether
|
|
10
|
+
// leading zeroes are allowed or not.
|
|
11
|
+
var regex = options.allow_leading_zeroes === false ? _int : intLeadingZeroes;
|
|
12
|
+
|
|
13
|
+
// Check min/max/lt/gt
|
|
14
|
+
var minCheckPassed = !options.hasOwnProperty('min') || isNullOrUndefined(options.min) || str >= options.min;
|
|
15
|
+
var maxCheckPassed = !options.hasOwnProperty('max') || isNullOrUndefined(options.max) || str <= options.max;
|
|
16
|
+
var ltCheckPassed = !options.hasOwnProperty('lt') || isNullOrUndefined(options.lt) || str < options.lt;
|
|
17
|
+
var gtCheckPassed = !options.hasOwnProperty('gt') || isNullOrUndefined(options.gt) || str > options.gt;
|
|
18
|
+
return regex.test(str) && minCheckPassed && maxCheckPassed && ltCheckPassed && gtCheckPassed;
|
|
19
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
import assertString from './util/assertString';
|
|
3
|
+
import includes from './util/includesArray';
|
|
4
|
+
import merge from './util/merge';
|
|
5
|
+
var default_json_options = {
|
|
6
|
+
allow_primitives: false,
|
|
7
|
+
allow_any_value: false
|
|
8
|
+
};
|
|
9
|
+
export default function isJSON(str, options) {
|
|
10
|
+
assertString(str);
|
|
11
|
+
try {
|
|
12
|
+
options = merge(options, default_json_options);
|
|
13
|
+
var obj = JSON.parse(str);
|
|
14
|
+
|
|
15
|
+
// When allow_any_value is true, accept anything that JSON.parse successfully parses
|
|
16
|
+
if (options.allow_any_value) {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
var primitives = [];
|
|
20
|
+
if (options.allow_primitives) {
|
|
21
|
+
primitives = [null, false, true];
|
|
22
|
+
}
|
|
23
|
+
return includes(primitives, obj) || !!obj && _typeof(obj) === 'object';
|
|
24
|
+
} catch (e) {/* ignore */}
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import assertString from './util/assertString';
|
|
2
|
+
import isBase64 from './isBase64';
|
|
3
|
+
export default function isJWT(str) {
|
|
4
|
+
assertString(str);
|
|
5
|
+
var dotSplit = str.split('.');
|
|
6
|
+
var len = dotSplit.length;
|
|
7
|
+
if (len !== 3) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
return dotSplit.reduce(function (acc, currElem) {
|
|
11
|
+
return acc && isBase64(currElem, {
|
|
12
|
+
urlSafe: true
|
|
13
|
+
});
|
|
14
|
+
}, true);
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import assertString from './util/assertString';
|
|
2
|
+
import merge from './util/merge';
|
|
3
|
+
import includes from './util/includesString';
|
|
4
|
+
var lat = /^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/;
|
|
5
|
+
var _long = /^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/;
|
|
6
|
+
var latDMS = /^(([1-8]?\d)\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|90\D+0\D+0)\D+[NSns]?$/i;
|
|
7
|
+
var longDMS = /^\s*([1-7]?\d{1,2}\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|180\D+0\D+0)\D+[EWew]?$/i;
|
|
8
|
+
var defaultLatLongOptions = {
|
|
9
|
+
checkDMS: false
|
|
10
|
+
};
|
|
11
|
+
export default function isLatLong(str, options) {
|
|
12
|
+
assertString(str);
|
|
13
|
+
options = merge(options, defaultLatLongOptions);
|
|
14
|
+
if (!includes(str, ',')) return false;
|
|
15
|
+
var pair = str.split(',');
|
|
16
|
+
if (pair[0].startsWith('(') && !pair[1].endsWith(')') || pair[1].endsWith(')') && !pair[0].startsWith('(')) return false;
|
|
17
|
+
if (options.checkDMS) {
|
|
18
|
+
return latDMS.test(pair[0]) && longDMS.test(pair[1]);
|
|
19
|
+
}
|
|
20
|
+
return lat.test(pair[0]) && _long.test(pair[1]);
|
|
21
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
import assertString from './util/assertString';
|
|
3
|
+
|
|
4
|
+
/* eslint-disable prefer-rest-params */
|
|
5
|
+
export default function isLength(str, options) {
|
|
6
|
+
assertString(str);
|
|
7
|
+
var min;
|
|
8
|
+
var max;
|
|
9
|
+
if (_typeof(options) === 'object') {
|
|
10
|
+
min = options.min || 0;
|
|
11
|
+
max = options.max;
|
|
12
|
+
} else {
|
|
13
|
+
// backwards compatibility: isLength(str, min [, max])
|
|
14
|
+
min = arguments[1] || 0;
|
|
15
|
+
max = arguments[2];
|
|
16
|
+
}
|
|
17
|
+
var presentationSequences = str.match(/[^\uFE0F\uFE0E][\uFE0F\uFE0E]/g) || [];
|
|
18
|
+
var surrogatePairs = str.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g) || [];
|
|
19
|
+
var len = str.length - presentationSequences.length - surrogatePairs.length;
|
|
20
|
+
var isInsideRange = len >= min && (typeof max === 'undefined' || len <= max);
|
|
21
|
+
if (isInsideRange && Array.isArray(options === null || options === void 0 ? void 0 : options.discreteLengths)) {
|
|
22
|
+
return options.discreteLengths.some(function (discreteLen) {
|
|
23
|
+
return discreteLen === len;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return isInsideRange;
|
|
27
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import assertString from './util/assertString';
|
|
2
|
+
var validators = {
|
|
3
|
+
'cs-CZ': function csCZ(str) {
|
|
4
|
+
return /^(([ABCDEFHIJKLMNPRSTUVXYZ]|[0-9])-?){5,8}$/.test(str);
|
|
5
|
+
},
|
|
6
|
+
'de-DE': function deDE(str) {
|
|
7
|
+
return /^((A|AA|AB|AC|AE|AH|AK|AM|AN|AÖ|AP|AS|AT|AU|AW|AZ|B|BA|BB|BC|BE|BF|BH|BI|BK|BL|BM|BN|BO|BÖ|BS|BT|BZ|C|CA|CB|CE|CO|CR|CW|D|DA|DD|DE|DH|DI|DL|DM|DN|DO|DU|DW|DZ|E|EA|EB|ED|EE|EF|EG|EH|EI|EL|EM|EN|ER|ES|EU|EW|F|FB|FD|FF|FG|FI|FL|FN|FO|FR|FS|FT|FÜ|FW|FZ|G|GA|GC|GD|GE|GF|GG|GI|GK|GL|GM|GN|GÖ|GP|GR|GS|GT|GÜ|GV|GW|GZ|H|HA|HB|HC|HD|HE|HF|HG|HH|HI|HK|HL|HM|HN|HO|HP|HR|HS|HU|HV|HX|HY|HZ|IK|IL|IN|IZ|J|JE|JL|K|KA|KB|KC|KE|KF|KG|KH|KI|KK|KL|KM|KN|KO|KR|KS|KT|KU|KW|KY|L|LA|LB|LC|LD|LF|LG|LH|LI|LL|LM|LN|LÖ|LP|LR|LU|M|MA|MB|MC|MD|ME|MG|MH|MI|MK|ML|MM|MN|MO|MQ|MR|MS|MÜ|MW|MY|MZ|N|NB|ND|NE|NF|NH|NI|NK|NM|NÖ|NP|NR|NT|NU|NW|NY|NZ|OA|OB|OC|OD|OE|OF|OG|OH|OK|OL|OP|OS|OZ|P|PA|PB|PE|PF|PI|PL|PM|PN|PR|PS|PW|PZ|R|RA|RC|RD|RE|RG|RH|RI|RL|RM|RN|RO|RP|RS|RT|RU|RV|RW|RZ|S|SB|SC|SE|SG|SI|SK|SL|SM|SN|SO|SP|SR|ST|SU|SW|SY|SZ|TE|TF|TG|TO|TP|TR|TS|TT|TÜ|ÜB|UE|UH|UL|UM|UN|V|VB|VG|VK|VR|VS|W|WA|WB|WE|WF|WI|WK|WL|WM|WN|WO|WR|WS|WT|WÜ|WW|WZ|Z|ZE|ZI|ZP|ZR|ZW|ZZ)[- ]?[A-Z]{1,2}[- ]?\d{1,4}|(ABG|ABI|AIB|AIC|ALF|ALZ|ANA|ANG|ANK|APD|ARN|ART|ASL|ASZ|AUR|AZE|BAD|BAR|BBG|BCH|BED|BER|BGD|BGL|BID|BIN|BIR|BIT|BIW|BKS|BLB|BLK|BNA|BOG|BOH|BOR|BOT|BRA|BRB|BRG|BRK|BRL|BRV|BSB|BSK|BTF|BÜD|BUL|BÜR|BÜS|BÜZ|CAS|CHA|CLP|CLZ|COC|COE|CUX|DAH|DAN|DAU|DBR|DEG|DEL|DGF|DIL|DIN|DIZ|DKB|DLG|DON|DUD|DÜW|EBE|EBN|EBS|ECK|EIC|EIL|EIN|EIS|EMD|EMS|ERB|ERH|ERK|ERZ|ESB|ESW|FDB|FDS|FEU|FFB|FKB|FLÖ|FOR|FRG|FRI|FRW|FTL|FÜS|GAN|GAP|GDB|GEL|GEO|GER|GHA|GHC|GLA|GMN|GNT|GOA|GOH|GRA|GRH|GRI|GRM|GRZ|GTH|GUB|GUN|GVM|HAB|HAL|HAM|HAS|HBN|HBS|HCH|HDH|HDL|HEB|HEF|HEI|HER|HET|HGN|HGW|HHM|HIG|HIP|HMÜ|HOG|HOH|HOL|HOM|HOR|HÖS|HOT|HRO|HSK|HST|HVL|HWI|IGB|ILL|JÜL|KEH|KEL|KEM|KIB|KLE|KLZ|KÖN|KÖT|KÖZ|KRU|KÜN|KUS|KYF|LAN|LAU|LBS|LBZ|LDK|LDS|LEO|LER|LEV|LIB|LIF|LIP|LÖB|LOS|LRO|LSZ|LÜN|LUP|LWL|MAB|MAI|MAK|MAL|MED|MEG|MEI|MEK|MEL|MER|MET|MGH|MGN|MHL|MIL|MKK|MOD|MOL|MON|MOS|MSE|MSH|MSP|MST|MTK|MTL|MÜB|MÜR|MYK|MZG|NAB|NAI|NAU|NDH|NEA|NEB|NEC|NEN|NES|NEW|NMB|NMS|NOH|NOL|NOM|NOR|NVP|NWM|OAL|OBB|OBG|OCH|OHA|ÖHR|OHV|OHZ|OPR|OSL|OVI|OVL|OVP|PAF|PAN|PAR|PCH|PEG|PIR|PLÖ|PRÜ|QFT|QLB|RDG|REG|REH|REI|RID|RIE|ROD|ROF|ROK|ROL|ROS|ROT|ROW|RSL|RÜD|RÜG|SAB|SAD|SAN|SAW|SBG|SBK|SCZ|SDH|SDL|SDT|SEB|SEE|SEF|SEL|SFB|SFT|SGH|SHA|SHG|SHK|SHL|SIG|SIM|SLE|SLF|SLK|SLN|SLS|SLÜ|SLZ|SMÜ|SOB|SOG|SOK|SÖM|SON|SPB|SPN|SRB|SRO|STA|STB|STD|STE|STL|SUL|SÜW|SWA|SZB|TBB|TDO|TET|TIR|TÖL|TUT|UEM|UER|UFF|USI|VAI|VEC|VER|VIB|VIE|VIT|VOH|WAF|WAK|WAN|WAR|WAT|WBS|WDA|WEL|WEN|WER|WES|WHV|WIL|WIS|WIT|WIZ|WLG|WMS|WND|WOB|WOH|WOL|WOR|WOS|WRN|WSF|WST|WSW|WTL|WTM|WUG|WÜM|WUN|WUR|WZL|ZEL|ZIG)[- ]?(([A-Z][- ]?\d{1,4})|([A-Z]{2}[- ]?\d{1,3})))[- ]?(E|H)?$/.test(str);
|
|
8
|
+
},
|
|
9
|
+
'de-LI': function deLI(str) {
|
|
10
|
+
return /^FL[- ]?\d{1,5}[UZ]?$/.test(str);
|
|
11
|
+
},
|
|
12
|
+
'en-IN': function enIN(str) {
|
|
13
|
+
return /^[A-Z]{2}[ -]?[0-9]{1,2}(?:[ -]?[A-Z])(?:[ -]?[A-Z]*)?[ -]?[0-9]{4}$/.test(str);
|
|
14
|
+
},
|
|
15
|
+
'en-SG': function enSG(str) {
|
|
16
|
+
return /^[A-Z]{3}[ -]?[\d]{4}[ -]?[A-Z]{1}$/.test(str);
|
|
17
|
+
},
|
|
18
|
+
'es-AR': function esAR(str) {
|
|
19
|
+
return /^(([A-Z]{2} ?[0-9]{3} ?[A-Z]{2})|([A-Z]{3} ?[0-9]{3}))$/.test(str);
|
|
20
|
+
},
|
|
21
|
+
'fi-FI': function fiFI(str) {
|
|
22
|
+
return /^(?=.{4,7})(([A-Z]{1,3}|[0-9]{1,3})[\s-]?([A-Z]{1,3}|[0-9]{1,5}))$/.test(str);
|
|
23
|
+
},
|
|
24
|
+
'hu-HU': function huHU(str) {
|
|
25
|
+
return /^((((?!AAA)(([A-NPRSTVZWXY]{1})([A-PR-Z]{1})([A-HJ-NPR-Z]))|(A[ABC]I)|A[ABC]O|A[A-W]Q|BPI|BPO|UCO|UDO|XAO)-(?!000)\d{3})|(M\d{6})|((CK|DT|CD|HC|H[ABEFIKLMNPRSTVX]|MA|OT|R[A-Z]) \d{2}-\d{2})|(CD \d{3}-\d{3})|(C-(C|X) \d{4})|(X-(A|B|C) \d{4})|(([EPVZ]-\d{5}))|(S A[A-Z]{2} \d{2})|(SP \d{2}-\d{2}))$/.test(str);
|
|
26
|
+
},
|
|
27
|
+
'pt-BR': function ptBR(str) {
|
|
28
|
+
return /^[A-Z]{3}[ -]?[0-9][A-Z][0-9]{2}|[A-Z]{3}[ -]?[0-9]{4}$/.test(str);
|
|
29
|
+
},
|
|
30
|
+
'pt-PT': function ptPT(str) {
|
|
31
|
+
return /^(([A-Z]{2}[ -·]?[0-9]{2}[ -·]?[0-9]{2})|([0-9]{2}[ -·]?[A-Z]{2}[ -·]?[0-9]{2})|([0-9]{2}[ -·]?[0-9]{2}[ -·]?[A-Z]{2})|([A-Z]{2}[ -·]?[0-9]{2}[ -·]?[A-Z]{2}))$/.test(str);
|
|
32
|
+
},
|
|
33
|
+
'sq-AL': function sqAL(str) {
|
|
34
|
+
return /^[A-Z]{2}[- ]?((\d{3}[- ]?(([A-Z]{2})|T))|(R[- ]?\d{3}))$/.test(str);
|
|
35
|
+
},
|
|
36
|
+
'sv-SE': function svSE(str) {
|
|
37
|
+
return /^[A-HJ-PR-UW-Z]{3} ?[\d]{2}[A-HJ-PR-UW-Z1-9]$|(^[A-ZÅÄÖ ]{2,7}$)/.test(str.trim());
|
|
38
|
+
},
|
|
39
|
+
'en-PK': function enPK(str) {
|
|
40
|
+
return /(^[A-Z]{2}((\s|-){0,1})[0-9]{3,4}((\s|-)[0-9]{2}){0,1}$)|(^[A-Z]{3}((\s|-){0,1})[0-9]{3,4}((\s|-)[0-9]{2}){0,1}$)|(^[A-Z]{4}((\s|-){0,1})[0-9]{3,4}((\s|-)[0-9]{2}){0,1}$)|(^[A-Z]((\s|-){0,1})[0-9]{4}((\s|-)[0-9]{2}){0,1}$)/.test(str.trim());
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
export default function isLicensePlate(str, locale) {
|
|
44
|
+
assertString(str);
|
|
45
|
+
if (locale in validators) {
|
|
46
|
+
return validators[locale](str);
|
|
47
|
+
} else if (locale === 'any') {
|
|
48
|
+
for (var key in validators) {
|
|
49
|
+
/* eslint guard-for-in: 0 */
|
|
50
|
+
var validator = validators[key];
|
|
51
|
+
if (validator(str)) {
|
|
52
|
+
return true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
}
|
|
57
|
+
throw new Error("Invalid locale '".concat(locale, "'"));
|
|
58
|
+
}
|