notion-utils
Advanced tools
Comparing version 4.17.0 to 4.18.0
@@ -11,3 +11,3 @@ "use strict"; | ||
var getBlockParentPage = function (block, recordMap) { | ||
var _a, _b, _c; | ||
var _a, _b; | ||
var currentRecord = block; | ||
@@ -22,3 +22,3 @@ while (currentRecord != null) { | ||
currentRecord = (_b = recordMap.block[parentId]) === null || _b === void 0 ? void 0 : _b.value; | ||
if (((_c = currentRecord) === null || _c === void 0 ? void 0 : _c.type) === 'page') { | ||
if ((currentRecord === null || currentRecord === void 0 ? void 0 : currentRecord.type) === 'page') { | ||
return currentRecord; | ||
@@ -25,0 +25,0 @@ } |
@@ -20,3 +20,3 @@ "use strict"; | ||
if (uuid) { | ||
return title + "-" + id; | ||
return "".concat(title, "-").concat(id); | ||
} | ||
@@ -23,0 +23,0 @@ else { |
@@ -8,3 +8,3 @@ "use strict"; | ||
if (!block.properties || !Object.keys(recordMap.collection)) { | ||
throw new Error("this block " + block.id + " has not properties or this recordMap has no collection record"); | ||
throw new Error("this block ".concat(block.id, " has not properties or this recordMap has no collection record")); | ||
} | ||
@@ -14,2 +14,5 @@ var collection = (_a = recordMap.collection[block.parent_id]) === null || _a === void 0 ? void 0 : _a.value; | ||
var propertyId = Object.keys(collection.schema).find(function (key) { var _a; return ((_a = collection.schema[key]) === null || _a === void 0 ? void 0 : _a.name) === propertyName; }); | ||
if (!propertyId) { | ||
return null; | ||
} | ||
var type = collection.schema[propertyId].type; | ||
@@ -26,3 +29,3 @@ var content = (0, get_text_content_1.getTextContent)(block.properties[propertyId]); | ||
if (formatDate.type == 'datetime') { | ||
return new Date(formatDate.start_date + " " + formatDate.start_time).getTime(); | ||
return new Date("".concat(formatDate.start_date, " ").concat(formatDate.start_time)).getTime(); | ||
} | ||
@@ -34,4 +37,4 @@ else if (formatDate.type == 'date') { | ||
var start_date = formatDate.start_date, start_time = formatDate.start_time, end_date = formatDate.end_date, end_time = formatDate.end_time; | ||
var startTime = new Date(start_date + " " + start_time).getTime(); | ||
var endTime = new Date(end_date + " " + end_time).getTime(); | ||
var startTime = new Date("".concat(start_date, " ").concat(start_time)).getTime(); | ||
var endTime = new Date("".concat(end_date, " ").concat(end_time)).getTime(); | ||
return [startTime, endTime]; | ||
@@ -38,0 +41,0 @@ } |
@@ -6,5 +6,5 @@ "use strict"; | ||
if (id === void 0) { id = ''; } | ||
return id.substr(0, 8) + "-" + id.substr(8, 4) + "-" + id.substr(12, 4) + "-" + id.substr(16, 4) + "-" + id.substr(20); | ||
return "".concat(id.substr(0, 8), "-").concat(id.substr(8, 4), "-").concat(id.substr(12, 4), "-").concat(id.substr(16, 4), "-").concat(id.substr(20)); | ||
}; | ||
exports.idToUuid = idToUuid; | ||
//# sourceMappingURL=id-to-uuid.js.map |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -8,3 +8,3 @@ /** | ||
export var getBlockParentPage = function (block, recordMap) { | ||
var _a, _b, _c; | ||
var _a, _b; | ||
var currentRecord = block; | ||
@@ -19,3 +19,3 @@ while (currentRecord != null) { | ||
currentRecord = (_b = recordMap.block[parentId]) === null || _b === void 0 ? void 0 : _b.value; | ||
if (((_c = currentRecord) === null || _c === void 0 ? void 0 : _c.type) === 'page') { | ||
if ((currentRecord === null || currentRecord === void 0 ? void 0 : currentRecord.type) === 'page') { | ||
return currentRecord; | ||
@@ -22,0 +22,0 @@ } |
@@ -17,3 +17,3 @@ import { uuidToId } from './uuid-to-id'; | ||
if (uuid) { | ||
return title + "-" + id; | ||
return "".concat(title, "-").concat(id); | ||
} | ||
@@ -20,0 +20,0 @@ else { |
@@ -5,3 +5,3 @@ import { getTextContent } from './get-text-content'; | ||
if (!block.properties || !Object.keys(recordMap.collection)) { | ||
throw new Error("this block " + block.id + " has not properties or this recordMap has no collection record"); | ||
throw new Error("this block ".concat(block.id, " has not properties or this recordMap has no collection record")); | ||
} | ||
@@ -11,2 +11,5 @@ var collection = (_a = recordMap.collection[block.parent_id]) === null || _a === void 0 ? void 0 : _a.value; | ||
var propertyId = Object.keys(collection.schema).find(function (key) { var _a; return ((_a = collection.schema[key]) === null || _a === void 0 ? void 0 : _a.name) === propertyName; }); | ||
if (!propertyId) { | ||
return null; | ||
} | ||
var type = collection.schema[propertyId].type; | ||
@@ -23,3 +26,3 @@ var content = getTextContent(block.properties[propertyId]); | ||
if (formatDate.type == 'datetime') { | ||
return new Date(formatDate.start_date + " " + formatDate.start_time).getTime(); | ||
return new Date("".concat(formatDate.start_date, " ").concat(formatDate.start_time)).getTime(); | ||
} | ||
@@ -31,4 +34,4 @@ else if (formatDate.type == 'date') { | ||
var start_date = formatDate.start_date, start_time = formatDate.start_time, end_date = formatDate.end_date, end_time = formatDate.end_time; | ||
var startTime = new Date(start_date + " " + start_time).getTime(); | ||
var endTime = new Date(end_date + " " + end_time).getTime(); | ||
var startTime = new Date("".concat(start_date, " ").concat(start_time)).getTime(); | ||
var endTime = new Date("".concat(end_date, " ").concat(end_time)).getTime(); | ||
return [startTime, endTime]; | ||
@@ -35,0 +38,0 @@ } |
export var idToUuid = function (id) { | ||
if (id === void 0) { id = ''; } | ||
return id.substr(0, 8) + "-" + id.substr(8, 4) + "-" + id.substr(12, 4) + "-" + id.substr(16, 4) + "-" + id.substr(20); | ||
return "".concat(id.substr(0, 8), "-").concat(id.substr(8, 4), "-").concat(id.substr(12, 4), "-").concat(id.substr(16, 4), "-").concat(id.substr(20)); | ||
}; | ||
//# sourceMappingURL=id-to-uuid.js.map |
{ | ||
"name": "notion-utils", | ||
"version": "4.17.0", | ||
"version": "4.18.0", | ||
"description": "Useful utilities for working with Notion data. Isomorphic.", | ||
@@ -19,3 +19,3 @@ "repository": "NotionX/react-notion-x", | ||
"dependencies": { | ||
"notion-types": "^4.17.0", | ||
"notion-types": "^4.18.0", | ||
"p-queue": "6" | ||
@@ -26,3 +26,3 @@ }, | ||
}, | ||
"gitHead": "360cba7a144c2ac3e052f1dbcf00422f0461e2bd" | ||
"gitHead": "3e2746657c411722babefade0209768368b40a2c" | ||
} |
@@ -38,2 +38,6 @@ import { Block, DateFormat, ExtendedRecordMap } from 'notion-types' | ||
if (!propertyId) { | ||
return null | ||
} | ||
const { type } = collection.schema[propertyId] | ||
@@ -40,0 +44,0 @@ const content = getTextContent(block.properties[propertyId]) |
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
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
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
362481
8996
Updatednotion-types@^4.18.0