Giter Site home page Giter Site logo

nav-faker's Introduction

nav-faker npm version Build status

nav-faker er et lite bibliotek som lar deg generere opp norske testdata. Biblioteket er under utvikling.

Planen er å implementere støtte for generering av tilfeldige:

  • Fødselsnummere / d-nummere
  • Adresser
  • Navn
  • Tall og datoer

Install

npm install --save nav-faker

Usage

React / Javascript

import navfaker from 'nav-faker/dist/index';

navfaker.personIdentifikator.fødselsnummer(); // => 10108000398

Test det ut

https://repl.it/@Quist/nav-faker-demo

API

Summary

nav-faker har følgende moduler:

  • dato
  • personIdentifikator
  • random
  • person
  • telefon

Dato

    mellom(fra: Date, til: Date): Date;
    forÅrSiden(årSiden: number): Date;

PersonIdentifikator

    fødselsnummer(fødselsdato?: Date, kjønn?: number): string;
    dnummer(fødselsdato?: Date, kjønn?: number): string;
    myndigFødselsnummer(kjønn?: number): string;
    getFødselsdato(fødselsnummer: string): Date;

Person

    kjønn(): number;
    antallBarn(fødselsdato: Date): number;

Random

    number(max?: number, min?: number): number;
    vektetSjanse(vekt: number): boolean;

Telefon

    mobil(): string;
    jobb(): string;

Bidra?

Kom gjerne med innspill, ønsker og pull-requester!

nav-faker er skrevet i typescript og kompileres ned til javascript. Dette kan da dras inn som en avhengighet av andre applikasjoner. nav-faker er satt opp med et CI bygg vha github actions.

Oppsett

Installer dependencies: yarn

Bygg og linting med: yarn build

Test

yarn test

Committe

Vi bruker verktøyet semantic-release for å bestemme når og hvilken versjon som skal publiseres til NPM. Verktøyet analysere commit-meldinger for å bestemme om patch, minor eller major versjon skal publiseres.

Du derfor følgende gjeldene commit-message convention. Man kan enten kjøre yarn commit, eller innstallere commitizen globalt via yarn global add commitizen og deretter kjøre git cz

Når du ønsker å commite: yarn commit

Publisering til NPM

Når kode merges inn i master, analyseres semantic-release commit-meldingene siden forrige publish til NPM. Basert på innholdet i meldingene, bestemmes om og isåfall hvordan versjon som skal publiseres.

Filosofi

nav-faker baserer seg på marak/faker. Mockingen deles inn i moduler, .f.eks fødselsnummer, dato og person. I utgangspunktet er planen å kun støtte å generere mock-data, ikke et util bibliotek.

Henvendelser

Spørsmål knyttet til koden eller prosjektet kan rettes mot:

Team Personoversikt

nav-faker's People

Contributors

abrhanav avatar bensteria avatar dependabot[bot] avatar eigilhs avatar henriksive avatar janeirik avatar jesperpaulsen avatar nutgaard avatar quist avatar vildestefferud avatar winsvold avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nav-faker's Issues

Automatisk publisering til npm

Såvidt jeg husker er det fremdeles min bruker som brukes for å publisere til npm. Enten må dere sette opp på travis en annen bruker, eller legge til meg som contributer her på github-repoet.

Legg meg gjerne til som contributor. @winsvold gjorde det, men det ble tatt bort når jeg ble fjernet fra github-organiasjonen til nav-ikt.

DUF-nummer

Vi bør støtte å generere duf-nummere. Duf-nummere blir tildelt asylsøkere.

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


No npm token specified.

An npm token must be created and set in the NPM_TOKEN environment variable on your CI environment.

Please make sure to create an npm token and to set it in the NPM_TOKEN environment variable on your CI environment. The token must allow to publish to the registry https://registry.npmjs.org/.


Good luck with your project ✨

Your semantic-release bot 📦🚀

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Invalid npm token.

The npm token configured in the NPM_TOKEN environment variable must be a valid token allowing to publish to the registry https://registry.npmjs.org/.

If you are using Two-Factor Authentication, make configure the auth-only level is supported. semantic-release cannot publish with the default auth-and-writes level.

Please make sure to set the NPM_TOKEN environment variable in your CI with the exact value of the npm token.


Good luck with your project ✨

Your semantic-release bot 📦🚀

Generering av D-nummer

Hei!
Ser at dere lager d-Nummer på følgende måte:

public dnummer(fødselsdato?: Date, kjønn?: number): string {
       const fødselsnummer = this.generer(fødselsdato, kjønn);

       const førsteSiffer = Number(fødselsnummer.charAt(0));
       const nyttFørstesiffer = førsteSiffer + 4;

       return String(nyttFørstesiffer).concat(fødselsnummer.substring(1));
   }

Blir ikke kontrollsifferene feil her? Kunne det være en ide å sende inn isDnummer av type bool til generer-funksjonen og plusse på 4 på førstesifferet før man regner ut kontrollsifferene?

PS: Superbra at dere lager dette. Ønsker støtte for DUF-Nummer også!

bitmoji

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.