Serialization and deserialization
Example
import { Parser } from "@thoughtsunificator/bookmarks-document"
Methods
(static) parseInternalJSON(data) → {BookmarksDocument}
Parameters:
| Name | Type | Description |
|---|---|---|
data |
BookmarkPayload |
Returns:
- Type
- BookmarksDocument
(static) parseHTML(html, document) → {BookmarksDocument}
- Description:
Create a BookmarksDocument from a Netscape Bookmark File
- Source:
- See:
Parameters:
| Name | Type | Description |
|---|---|---|
html |
str | |
document |
Document |
Returns:
- Type
- BookmarksDocument
(static) deserialize(data, parentBookmark) → {BookmarkFolder|BookmarkLink}
Parameters:
| Name | Type | Description |
|---|---|---|
data |
DataBookmarkFolder | DataBookmarkLink | |
parentBookmark |
BookmarkFolder |
Returns:
- Type
- BookmarkFolder | BookmarkLink
(static) createNetscapeBookmarkDocument(bookmarksDocument, document) → {Document}
- Description:
Create a Netscape bookmark document from a bookmarkFolder given a Document is provided
- Source:
- To Do:
-
- untested
- not working atm because the Netscape Bookmark Document is not valid HTML. There is need for an additional Parser
Parameters:
| Name | Type | Description |
|---|---|---|
bookmarksDocument |
BookmarksDocument | |
document |
Document |
Returns:
- Type
- Document
Type Definitions
BookmarkPayload
- Source:
- To Do:
-
- Move to another repository, this parser will be used by the server This module is responsible for the parsing of internal and external bookmark documents.
- The Parser module should not have to know any details about the BookmarksDocument. It should work with data payload (DataBookmarkLink & DataBookmarkFolder)
- Fix netscape bookmark document
Properties:
| Name | Type | Attributes | Description |
|---|---|---|---|
type |
str | ||
title |
str | ||
createdAt |
str | Valid ISO 8601 date string |
|
updatedAt |
str |
<optional> |
Valid ISO 8601 date string |
children |
Array.<(DataBookmarkLink|DataBookmarkFolder)> | ||
type |
str | ||
title |
str | ||
createdAt |
str | Valid ISO 8601 date string |
|
updatedAt |
str |
<optional> |
Valid ISO 8601 date string |
url |
str | ||
icon |
str | BookmarkPayload is used to serialize from and deserialize to a BookmarksDocument |
Type:
- object