Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PathHelper

Helper class for path-related functions and methods

The class contains general helper methods for joining, splitting, modifying and validating paths.

Hierarchy

  • PathHelper

Index

Methods

Static getContentUrl

  • getContentUrl(idOrPath: string | number): string
  • Returns the full path for a content based on its Id or Path

    Parameters

    • idOrPath: string | number

      the Id Or Path of the content

    Returns string

    A full Id or Path-based url of the content (e.g. '/content(1)' or '/Root/Example/('Content')')

Static getContentUrlByPath

  • getContentUrlByPath(path: string): string
  • Method that gets the URL that refers to a single item in the Sense/Net Content Repository

    Parameters

    • path: string

      Path that you want to format.

    Returns string

    Path in entity format e.g. /workspaces('project') from /workspaces/project

Static getContentUrlbyId

  • getContentUrlbyId(id: number): string
  • Method that gets the URL that refers to a single item in the Sense/Net Content Repository by its Id

    Parameters

    • id: number

      Id of the Content.

    Returns string

    e.g. /content(123)

Static getParentPath

  • getParentPath(path: string): string
  • Returns the parent path from a specified path. e.g. "/Root/Example/Content" will return "/Root/Example"

    "Root" will always return "Root"

    Parameters

    • path: string

      The content path

    Returns string

Static getSegments

  • getSegments(path: string): string[]
  • Splits a full path into path segments, e.g.: /Root/Example('Content1') will be ["Root", "Example", "('Content1')"]

    Parameters

    • path: string

      The path to be splitted

    Returns string[]

    the segments for the path

Static isAncestorOf

  • isAncestorOf(ancestorPath: string, descendantPath: string): boolean
  • Checks if the ancestorPath is really the ancestor of the descendantPath

    Parameters

    • ancestorPath: string

      the ancestor path

    • descendantPath: string

      the descendant path

    Returns boolean

    if the provided path is the ancestor of the descendant

Static isItemPath

  • isItemPath(path: string): boolean
  • Method that tells if a path is an item path or an item reference path (e.g. contains an Item segment).

    Parameters

    • path: string

      Path that you want to test.

    Returns boolean

    Returns if the given path is a path of a Content or not.

Static isItemSegment

  • isItemSegment(segment: string): boolean
  • Checks if a specific segment is an Item segment or not (like "('Content1')")

    Parameters

    • segment: string

      The segment to be examined

    Returns boolean

Static joinPaths

  • joinPaths(...args: string[]): string
  • Method that allows to join paths without multiple or missing slashes

    Parameters

    • Rest ...args: string[]

      The list of the paths to join

    Returns string

Static trimSlashes

  • trimSlashes(path: string): string
  • Trims the slash characters from the beginning and from the end of the path to avoid duplicated slashes

    Parameters

    • path: string

      The source path that should be trimmed

    Returns string

Generated using TypeDoc