Organization meta. Find all implementations on organisationsnummer.dev.
Every package should have .meta.yaml
file containing information about the name, maintainer, specification version and which workflow file to show the build badge from. The values of the meta file will be used for the implementations table on organisationsnummer.dev
Example of .meta.yaml
name: "JavaScript"
maintainer: "@frozzare"
spec: 1.1
workflow: "nodejs.yml"
We use the MIT license for all packages and the copyright row should look like this:
Copyright (c) Organisationsnummer and Contributors
Dash or plus should be optional.
NNNNNN-NNNN
NNNNNNNNNN
Personnummer should also be a valid organisationsnummer.
The package should include a class that includes a constructor and parse on new instance. The constructor may be different depending on language.
class Organisationsnummer {
public function __construct(string)
}
The package should include a parse
method or a static method that creates a new instance of the new class.
organisationsnummer.parse(string) => new class instance
The class should contain a static parse
method that returns the class instance.
Output for short format
method
NNNNNN-NNNN
Output for long format
method
NNNNNNNNNN
The valid
function can be a function or a static method on the class depending on language.
All methods except for valid
should throw an exception or return an error as a second return value. Error handling may be different depending on language. The exception/error class should be prefixed with Organisationsnummer
The type method can be called type
or getType
depending on language.
interface Organisationsnummer {
public function __construct(string input);
// static method or functional export, see parse spec.
public static function parse(string input);
public function format(boolean separator = true) : string;
public function isPersonnummer(): boolean;
public function personnummer(): Personnummer | null;
public function type() : string;
}
function valid(string input) {
try {
parse(input)
return true
} catch (OrganisationsnummerException) {
return false
}
}
// static method or functional export, see parse spec.
function parse(string input) {
return new Organisationsnummer(input)
}
This specification adds new features and includes all parts from 1.0.
The package should include vatNumber
method that should return the vat number for a organization number.
interface Organisationsnummer {
function vatNumber(): string
}