Person.Model.ValueObjects 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Person.Model.ValueObjects --version 1.0.0                
NuGet\Install-Package Person.Model.ValueObjects -Version 1.0.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Person.Model.ValueObjects" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Person.Model.ValueObjects --version 1.0.0                
#r "nuget: Person.Model.ValueObjects, 1.0.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Person.Model.ValueObjects as a Cake Addin
#addin nuget:?package=Person.Model.ValueObjects&version=1.0.0

// Install Person.Model.ValueObjects as a Cake Tool
#tool nuget:?package=Person.Model.ValueObjects&version=1.0.0                

Person.Model.ValueObjects

A .NET Standard 2.1 collection with value objects that intend to model some Brazilian's Person domain properties

Employer Identification Number

CNPJ - Cadastro Nacional de Pessoa Jurídica
A string-based struct that models the Brazilian's Employer Identification Number

CNPJ - Creation

// with new operator
var cnpj = new CNPJ("39612247000102");

// with string implicity operator
CNPJ cnpj = "39612247000102";

// can be nullable
CNJP? cnpj = null;

CNPJ - Dismembering

 CNPJ cnpj = "39612247000102";
 
 console.log(cnpj.Raw);
 # 39612247000102
 
 console.log(cnpj.Number);
 # 396122470001
 
 console.log(cnpj.CheckNumber);
 # 02

CNPJ - Formatting

 CNPJ cnpj = "39612247000102";

// with ToString method
console.log(cnpj.ToString());
# 39.612.247\0001-02

// with string implicity operator
console.log(cnpj);
# 39.612.247\0001-02

CNPJ - Helper Functions

// non-numeric
CNPJ.IsNumeric("39 12247A00102");
# false

// not fourteen size length
CNPJ.IsFourteenLength("396122470001020000");
# false

// in range
CNPJ.IsOutOfRange("39612247000102");
# false

// out of range
// non-numeric or not forteend size length
CNPJ.IsOutOfRange("396 K 224 0 SDDFG 010A0000");
# true
CNPJ.IsOutOfRange("396122470001020000");
# true
CNPJ.IsOutOfRange("39 12247A00102");
# true

// in range and valid cnpj
CNPJ.IsValid("39612247000102");
# true

// get number part of cnpj in range candidate
CNPJ.GetNumberFrom("39612247000102");
# 396122470001

// get check number part of in range cnpj candidate
CNPJ.GetCheckNumberFrom("39612247000102");
# 02

Social Security Number

CPF - Cadastro de Pessoa Física
A string-based struct that models the Brazilian's Social Security Number

CPF - Creation

// with new operator
var cpf = new CPF("99194415030");

// with string implicity operator
CPF cpf = "99194415030";

// can be nullable
CPF? cpf = null;

CPF - Dismembering

 CPF cpf = "99194415030";
 
 console.log(cpf.Raw);
 # 99194415030
 
 console.log(cpf.Number);
 # 991944150
 
 console.log(cpf.CheckNumber);
 # 30

CPF - Formatting

CPF cpf = "99194415030";

// with ToString method
console.log(cpf.ToString());
# 991.944.150-30

// with string implicity operator
console.log(cpf);
# 991.944.150-30

CPF - Helper Functions

// non-numeric
CPF.IsNumeric("991 94 415 030");
# false

// not eleven size length
CPF.IsElevenLength("991944150302342");
# false

// in range
CPF.IsOutOfRange("99194415030");
# false

// out of range
// non-numeric or not eleven size length
CPF.IsOutOfRange("991 944 ABC 1503024332423");
# true
CPF.IsOutOfRange("99194415030243");
# true
CPF.IsOutOfRange("991944 ABC 150");
# true

// in range and valid cnpj
CPF.IsValid("99194415030");
# true

// get number part of cnpj in range candidate
CPF.GetNumberFrom("99194415030");
# 991944150

// get check number part of in range cnpj candidate
CPF.GetCheckNumberFrom("99194415030");
# 30

Land Line Phone Number

A string-based struct that models the Brazilian's land line phone number in ANATEL's standard format

Land Line - Creation

// with new operator
var landLine = new LandLine("5126352520");

// with string implicity operator
LandLine landLine = "5126352520";

// can be null
LandLine? landLine = null;

// accept mutiple formats on creation
// all the signs and spaces are optional
// it does not accept double spaces.
// ^(\+?55 ?)? ?(\([1-9]{2}\)|[1-9]{2}) ?([2-5]\d{3}[-| ]?\d{4})$

LandLine landLine = "+55(51)2635-2520";
LandLine landLine = "+55 (51) 2635-2520";
LandLine landLine = "55 51 2635 2520";

Land Line - Dismembering

 LandLine landLine = "555126352520";
 
 console.log(landLine.Raw);
 # 555126352520
 
 console.log(landLine.CountryCode);
 # 55
 
 console.log(landLine.AreaCode);
 # 51

console.log(landLine.Number);
# 26352520

Mobile Phone Number

A string-based struct that models the Brazilian's mobile phone number in ANATEL's standard format

Mobile - Creation

// with new operator
var mobile = new Mobile("51932321078");

// with string implicity operator
Mobile mobile = "51932321078";

// can be null
Mobile? mobile = null;

// accept mutiple formats on creation
// all the signs and spaces are optional
// it does not accept double spaces.
// ^(\+?55 ?)? ?(\([1-9]{2}\)|[1-9]{2}) ?(9\d{4}[-| ]?\d{4})$

Mobile mobile = "+55(51)93232-1078";
Mobile mobile = "+55 (51) 93232-1078";
Mobile mobile = "55 51 93232 1078";

Mobile - Dismembering

 Mobile mobile = "5551932321078";
 
 console.log(mobile.Raw);
 # 5551932321078
 
 console.log(mobile.CountryCode);
 # 55
 
 console.log(mobile.AreaCode);
 # 51

console.log(mobile.Number);
# 932321078
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
8.0.0 381 1/30/2024
2.0.0 1,435 10/25/2021
1.0.4 621 3/23/2021
1.0.3 392 3/23/2021
1.0.2 354 3/22/2021
1.0.1 331 3/8/2021
1.0.0 397 1/11/2021

Versão inicial