1.0.3 • Published 1 year ago

nv-facutil-spath v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

nv-facutil-spath

  • a simple path format used in nvlang
  • same as \<str>.split("/"), just return the reason IF unmatch restriction
  • for test Path DataType in nvlang (in nvlang ,path is a primitive type)

      <path>:

          "/" <ele> "/"  <ele> "/"  .....  <ele>               #means leaf 
          "/" <ele> "/"  <ele> "/"  .....  <ele> "/"           #means nonleaf
       
       <ele>: String     
           ^[_a-z][_a-z0-9]*$

       <path> must_start_with: '/'
       <ele>  must_be_a_string MATCH ^[_a-z][_a-z0-9]*$        #which means it is a valid lowdash-lowercase'a2z-digit-only js-identifier-name      
                         
           

install

  • npm install nv-facutil-spath

usage

  const {parse_and_vali }   = require("nv-facutil-spath");

example

    parse_and_vali("/a/b/c/")
    >
    [ true, [ '', 'a', 'b', 'c', '' ] ]
    >
    parse_and_vali("/a/b/c")
    >
    [ true, [ '', 'a', 'b', 'c' ] ]
    > 

METHODS

APIS

            {
              PATHSP: '/',
              parse_and_vali: [Function: parse_and_vali],
              is_leaf_pl: [Function: is_leaf_pl],
              is_nonleaf_pl: [Function: is_nonleaf_pl],
              a2p: [Function: a2p]
            }

LICENSE

  • ISC