query
On this page

strMatching

lib.types.strMatching

Docs pulled from | This Revision | 24 minutes ago


Contribute
Enhance the ecosystem with your expertise! Contribute to fill the gaps in documentation. Your input can make a difference.

Noogle detected

Implementation

The following is the current implementation of this function.

pattern:
    mkOptionType {
      name = "strMatching ${escapeNixString pattern}";
      description = "string matching the pattern ${pattern}";
      descriptionClass = "noun";
      check = x: str.check x && builtins.match pattern x != null;
      inherit (str) merge;
      functor = defaultFunctor "strMatching" // {
        type = payload: strMatching payload.pattern;
        payload = { inherit pattern; };
        binOp = lhs: rhs: if lhs == rhs then lhs else null;
      };
    }