notion-utils
Advanced tools
Comparing version 4.8.2 to 4.8.6
@@ -12,2 +12,2 @@ import * as types from 'notion-types'; | ||
*/ | ||
export declare const getPageTableOfContents: (recordMap: types.ExtendedRecordMap) => Array<TableOfContentsEntry>; | ||
export declare const getPageTableOfContents: (page: types.PageBlock, recordMap: types.ExtendedRecordMap) => Array<TableOfContentsEntry>; |
@@ -14,5 +14,5 @@ "use strict"; | ||
*/ | ||
var getPageTableOfContents = function (recordMap) { | ||
var _a, _b; | ||
var toc = ((_b = Object.keys((_a = recordMap === null || recordMap === void 0 ? void 0 : recordMap.block) !== null && _a !== void 0 ? _a : {})) !== null && _b !== void 0 ? _b : []) | ||
var getPageTableOfContents = function (page, recordMap) { | ||
var _a; | ||
var toc = ((_a = page.content) !== null && _a !== void 0 ? _a : []) | ||
.map(function (blockId) { | ||
@@ -19,0 +19,0 @@ var _a, _b; |
@@ -12,2 +12,2 @@ import * as types from 'notion-types'; | ||
*/ | ||
export declare const getPageTableOfContents: (recordMap: types.ExtendedRecordMap) => Array<TableOfContentsEntry>; | ||
export declare const getPageTableOfContents: (page: types.PageBlock, recordMap: types.ExtendedRecordMap) => Array<TableOfContentsEntry>; |
@@ -11,5 +11,5 @@ import { getTextContent } from './get-text-content'; | ||
*/ | ||
export var getPageTableOfContents = function (recordMap) { | ||
var _a, _b; | ||
var toc = ((_b = Object.keys((_a = recordMap === null || recordMap === void 0 ? void 0 : recordMap.block) !== null && _a !== void 0 ? _a : {})) !== null && _b !== void 0 ? _b : []) | ||
export var getPageTableOfContents = function (page, recordMap) { | ||
var _a; | ||
var toc = ((_a = page.content) !== null && _a !== void 0 ? _a : []) | ||
.map(function (blockId) { | ||
@@ -16,0 +16,0 @@ var _a, _b; |
{ | ||
"name": "notion-utils", | ||
"version": "4.8.2", | ||
"version": "4.8.6", | ||
"description": "Useful utilities for working with Notion data. Isomorphic.", | ||
@@ -25,3 +25,3 @@ "repository": "NotionX/react-notion-x", | ||
}, | ||
"gitHead": "4a51f852262db0953b19e3e02325964859cb1150" | ||
"gitHead": "e0b8f112d99b086cd72858c2d7d3882029c6ead9" | ||
} |
@@ -22,5 +22,6 @@ import * as types from 'notion-types' | ||
export const getPageTableOfContents = ( | ||
page: types.PageBlock, | ||
recordMap: types.ExtendedRecordMap | ||
): Array<TableOfContentsEntry> => { | ||
const toc = (Object.keys(recordMap?.block ?? {}) ?? []) | ||
const toc = (page.content ?? []) | ||
.map((blockId: string) => { | ||
@@ -27,0 +28,0 @@ const block = recordMap.block[blockId]?.value |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
8750
777722