Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fundamental-constants

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fundamental-constants

Fundamental constants and enumerations

  • 0.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
68
decreased by-19.05%
Maintainers
0
Weekly downloads
 
Created
Source

Fundamental constants and enumerations.

Some of their values are commonly known, for example the HOURS_COUNT_IN_STELLAR_DAY is 24 and MAXIMAL_DAYS_IN_MONTH is 31. However, without being stored to the constants with clear names, it will be the magic numbers.

Installation

npm i fundamental-constants -E

Content

Computer Networking

Constant NameValue
HTTP_DEFAULT_PORT80
HTTPS_DEFAULT_PORT443
NETWORK_PORT_MAXIMAL_VALUE65535
NETWORK_PORT_MINIMAL_VALUE1
Enumerations
HTTP_Methods
KeyValue
get"GET"
post"POST"
create"CREATE"
put"PUT"
delete"DELETE"
options"OPTIONS"
head"HEAD"
connect"CONNECT"
trace"TRACE"
patch"PATCH"
HTTP Status Codes
HTTP_StatusCodes — All HTTP Status Codes
KeyValue
continue100
switchingProtocols101
processing102
earlyHints103
OK200
created201
accepted202
nonAuthoritativeInformation203
noContent204
resetContent205
partialContent206
multiStatus207
alreadyReported208
IM_Used226
multipleChoices300
movedPermanently301
found302
seeOther303
notModified304
useProxy305
unused306
temporaryRedirect307
permanentRedirect308
badRequest400
unauthorized401
paymentRequired402
forbidden403
notFound404
methodNotAllowed405
notAcceptable406
proxyAuthenticationRequired407
requestTimeout408
conflict409
gone410
lengthRequired411
preconditionFailed412
payloadTooLarge413
URI_TooLong414
unsupportedMediaType415
rangeNotSatisfiable416
expectationFailed417
IAmATeapot418
misdirectedRequest421
unprocessableEntity422
locked423
failedDependency424
tooEarly425
upgradeRequired426
preconditionRequired428
tooManyRequests429
requestHeaderFieldsTooLarge431
unavailableForLegalReasons451
internalServerError500
notImplemented501
badGateway502
serviceUnavailable503
gatewayTimeout504
HTTP_VersionNotSupported505
variantAlsoNegotiates506
insufficientStorage507
loopDetected508
notExtended510
networkAuthenticationRequired511
InformationalResponsesHTTP_StatusCodes — Information Responses
KeyValue
continue100
switchingProtocols101
processing102
earlyHints103
SuccessfulResponsesHTTP_StatusCodes — Successful Responses
KeyValue
OK200
created201
accepted202
nonAuthoritativeInformation203
noContent204
resetContent205
partialContent206
multiStatus207
alreadyReported208
IM_Used226
RedirectionResponsesHTTP_StatusCodes — Redirection Messages
KeyValue
multipleChoices300
movedPermanently301
found302
seeOther303
notModified304
useProxy305
unused306
temporaryRedirect307
permanentRedirect308
ClientErrorsHTTP_StatusCodes — Client Error Responses
KeyValue
badRequest400
unauthorized401
paymentRequired402
forbidden403
notFound404
methodNotAllowed405
notAcceptable406
proxyAuthenticationRequired407
requestTimeout408
conflict409
gone410
lengthRequired411
preconditionFailed412
payloadTooLarge413
URI_TooLong414
unsupportedMediaType415
rangeNotSatisfiable416
expectationFailed417
IAmATeapot418
misdirectedRequest421
unprocessableEntity422
locked423
failedDependency424
tooEarly425
upgradeRequired426
preconditionRequired428
tooManyRequests429
requestHeaderFieldsTooLarge431
unavailableForLegalReasons451
ServerErrorsHTTP_StatusCodes — Server Error Responses
KeyValue
internalServerError500
notImplemented501
badGateway502
serviceUnavailable503
gatewayTimeout504
HTTP_VersionNotSupported505
variantAlsoNegotiates506
insufficientStorage507
loopDetected508
notExtended510
networkAuthenticationRequired511

DataTypes

IntegerDataTypes
IntegerDataTypes enumeration
KeyValue
oneByte"1_BYTE_INTEGER"
twoBytes"2_BYTES_INTEGER"
threeBytes"3_BYTES_INTEGER"
fourBytes"4_BYTES_INTEGER"
eightBytes"8_BYTES_INTEGER"
Minimal and Maximal Values
Constant NameValue
MAXIMAL_VALUE_OF_1_BYTE_INTEGER127
MINIMAL_VALUE_OF_1_BYTE_INTEGER-128
MAXIMAL_VALUE_OF_2_BYTES_INTEGER32,767
MINIMAL_VALUE_OF_2_BYTES_INTEGER-32,768
MAXIMAL_VALUE_OF_3_BYTES_INTEGER8,388,607
MINIMAL_VALUE_OF_3_BYTES_INTEGER-8,388,608
MAXIMAL_VALUE_OF_4_BYTES_INTEGER2,147,483,647
MINIMAL_VALUE_OF_4_BYTES_INTEGER-2,147,483,648
MAXIMAL_VALUE_OF_8_BYTES_INTEGER9,223,372,036,854,775,807
MINIMAL_VALUE_OF_8_BYTES_INTEGER-9,223,372,036,854,775,808
Class Integer and Interface IntegerConstructor

The analogue of Number and NumberConstructor respectively pointing that target number is integer. Both class Integer and interface IntegerConstructor are empty. Intended to be used for describing of business rules alongside with native types like String and StringConstructor:

namespace Resident {

  export namespace Age {
    export const TYPE: IntegerConstructor = Integer;
    export const IS_REQUIRED: boolean = true;
    export const MINIMAL_VALUE: number = 0;
    export const MAXIMAL_VALUE: number = 200;
  }

  // Another examle
  export namespace Birthplace {
    export const TYPE: StringConstructor = String;
    export const IS_REQUIRED: boolean = true;
    export const MINIMAL_CHARACTERS_COUNT: number = 1;
    export const MAXIMAL_CHARACETRS_COUNT: number = 255;
  }
  
}
Floating Point Data Types
FloatingPointDataTypes
KeyValue
fourBytes"4_BYTES_FLOAT_POINT"
eightBytes"8_BYTES_FLOAT_POINT"
sixteenBytes"16_BYTES_FLOAT_POINT"

Date and Time

Constant nameValue
DAYS_COUNT_IN_WEEK7
HOURS_COUNT_IN_STELLAR_DAY24
MAXIMAL_DAYS_IN_MONTH31
MAXIMAL_SUPPORTED_UNIX_MILLISECONDS_AMOUNT8640000000000000
MINIMAL_SUPPORTED_UNIX_MILLISECONDS_AMOUNT-8640000000000000
MINUTES_COUNT_IN_HOUR60
MONTHS_COUNT_IN_YEAR12
SECONDS_COUNT_IN_MINUTE60
Enumerations
DaysOfWeekNames
KeyValue
sunday"SUNDAY"
monday"MONDAY"
tuesday"TUESDAY"
wednesday"WEDNESDAY"
thursday"THURSDAY"
friday"FRIDAY"
saturday"SATURDAY"
MonthsNames
KeyValue
january"JANUARY"
february"FEBRUARY"
march"MARCH"
april"APRIL"
may"MAY"
june"JUNE"
july"JULY"
august"AUGUST"
september"SEPTEMBER"
october"OCTOBER"
november"NOVEMBER"
december"DECEMBER"
ISO8601
Constant nameValue
MAXIMAL_CHARACTERS_COUNT_IN_DATE_PART_OF_ISO8601_STRING10
CHARACTERS_COUNT_IN_FULL_ISO8601_STRING24

Email

Constant nameValue
EMAIL_ADDRESS_VALID_PATTERN/^\w+(?:[.-]?\w+)*@\w+(?:[.-]?\w+)*(?:\.\w{2,3})+$/u
MAXIMAL_CHARACTERS_COUNT_OF_EMAIL_ADDRESS320
MINIMAL_CHARACTERS_COUNT_OF_EMAIL_ADDRESS3

Other

Constant nameValue
FIXED_CHARACTERS_COUNT_IN_UNIVERSAL_UNIQUE_ID__VERSION_436

Keywords

FAQs

Package last updated on 13 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc