logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Data::Sah::Normalize - Normalize Sah schema

Author

       perlancar <perlancar@cpan.org>

Bugs

       Please report any bugs or feature requests on the bugtracker website
       <https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Sah-Normalize>

       When submitting a bug or request, please include a test-file or a patch to an existing test-file that
       illustrates the bug or desired feature.

Contributor

       Steven Haryanto <sharyanto@cpan.org>

Description

       This often-needed functionality is split from the main Data::Sah to keep it in a small and minimal-
       dependencies package.

Functions

normalize_clset($clset)=>HASH
       Normalize a clause set (hash). Return a shallow copy of the original hash. Die on failure.

       TODO: option to recursively normalize clause which contains sah clauses (e.g.  "of").

   normalize_schema($sch)=>ARRAY
       Normalize a Sah schema (scalar or array). Return an array. Produce a 2-level copy of schema, so it's safe
       to add/delete/modify the normalized schema's clause set, but clause set's values are still references to
       the original. Die on failure.

       TODO: recursively normalize clause which contains sah clauses (e.g. "of").

Homepage

       Please visit the project's homepage at <https://metacpan.org/release/Data-Sah-Normalize>.

Name

       Data::Sah::Normalize - Normalize Sah schema

See Also

       Sah, Data::Sah

Source

       Source repository is at <https://github.com/perlancar/perl-Data-Sah-Normalize>.

Synopsis

        use Data::Sah::Normalize qw(normalize_clset normalize_schema);

        my $nclset = normalize_clset({'!a'=>1}); # -> {a=>1, 'a.op'=>'not'}
        my $nsch   = normalize_schema("int");    # -> ["int", {}]

Version

       This document describes version 0.051 of Data::Sah::Normalize (from Perl distribution Data-Sah-
       Normalize), released on 2021-07-29.

See Also