DIR : /home/kozerus/public_html/cropex/node/node_modules/@hookform/resolvers/io-ts/src/arrayToPath.ts

/home/kozerus/public_html/cropex/node/node_modules/@hookform/resolvers/io-ts/src

import * as Either from 'fp-ts/Either';
import { pipe } from 'fp-ts/function';

const arrayToPath = (paths: Either.Either<string, number>[]): string =>
  paths.reduce(
    (previous, path, index) =>
      pipe(
        path,
        Either.fold(
          (key) => `${index > 0 ? '.' : ''}${key}`,
          (key) => `[${key}]`,
        ),
        (path) => `${previous}${path}`,
      ),
    '',
  );

export default arrayToPath;
//


koh5_pano



Your browser does not support the HTML5 canvas element.


Drag mouse to navigate.

Navigation





17.Aug.2010, Martin Wengenmayer