Home Manual Reference Source Repository
import JSONPointer from 'vulp/src/JSONPointer/index.js'
public class | source

JSONPointer

JSON Pointer defines a string format for identifying a specific value within a JSON document.

This class holds methods for manipulation of pointers.

For more information:

Static Method Summary

Static Public Methods
public static

parse str and return JSONPointer

public static

ofTokens(tokens: *): *

Constructor Summary

Public Constructor
public

JSONPointer constructors

Member Summary

Public Members
public

tokens: *

Method Summary

Public Methods
public

concat two JSONPointer

public

get first token

public

get last token

public

return length of token array

public

slice JSONPointer

public

get immutable js string representation

public

get rfc string representation

Static Public Methods

public static ofString(str: string): JSONPointer source

parse str and return JSONPointer

If x starts with '/' create will treat x as a JSONPointer. All other string will be treated like immutable js pointer (eg.: 'foo.bar')

Params:

NameTypeAttributeDescription
str string

pointer string

Return:

JSONPointer

public static ofTokens(tokens: *): * source

Params:

NameTypeAttributeDescription
tokens *

Return:

*

Public Constructors

public constructor(opts: Object) source

JSONPointer constructors

Params:

NameTypeAttributeDescription
opts Object

options.

opts.tokens TokenList

json path tokens

Public Members

public tokens: * source

Public Methods

public concat(sub: JSONPointer): JSONPointer source

concat two JSONPointer

Params:

NameTypeAttributeDescription
sub JSONPointer

the pointer to concat

Return:

JSONPointer

public first(): string source

get first token

Return value is the first entry from token list.

Return:

string

public last(): string source

get last token

Return value is the last entry from token list.

Return:

string

public size(): number source

return length of token array

Return:

number

public slice(): JSONPointer source

slice JSONPointer

slice has the same signature like Array.prototype.slice.

Return:

JSONPointer

public toImmutable(): string source

get immutable js string representation

Return:

string

public toRFC(): string source

get rfc string representation

Return:

string