the-moby-effect
Version:
Moby/Docker API client built using effect-ts
31 lines • 952 B
JavaScript
/**
* Mac Address schema.
*
* @since 1.0.0
*/
import * as Brand from "effect/Brand";
import * as Function from "effect/Function";
import * as Schema from "effect/Schema";
/**
* @since 1.0.0
* @category Regular expressions
* @see https://stackoverflow.com/questions/4260467/what-is-a-regular-expression-for-a-mac-address
*/
export const MacAddressRegex = /*#__PURE__*/new RegExp("^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$");
/**
* @since 1.0.0
* @category Branded constructors
*/
export const MacAddressBrand = /*#__PURE__*/Brand.nominal();
/**
* A Mac Address.
*
* @since 1.0.0
* @category Schemas
*/
export const MacAddress = /*#__PURE__*/Function.pipe(Schema.String, /*#__PURE__*/Schema.pattern(MacAddressRegex), /*#__PURE__*/Schema.fromBrand(MacAddressBrand), /*#__PURE__*/Schema.annotations({
identifier: "MacAddress",
title: "A MacAddress",
description: "A network interface's MacAddress"
}));
//# sourceMappingURL=mac.js.map