mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-11 11:26:37 +03:00
19 lines
394 B
JavaScript
19 lines
394 B
JavaScript
'use strict';
|
|
import JsonPointerLib from 'json-pointer';
|
|
|
|
/**
|
|
* Wrapper for JsonPointer. Provides common operations
|
|
*/
|
|
export class JsonPointer extends JsonPointerLib {
|
|
|
|
/**
|
|
* returns last JsonPointer token
|
|
* @example
|
|
* // returns subpath
|
|
* new JsonPointerHelper.dirName('/path/0/subpath')
|
|
*/
|
|
static dirName(pointer) {
|
|
return JsonPointer.parse(pointer).pop();
|
|
}
|
|
}
|