UNPKG
@codesled/content
Version:
latest (0.1.0)
0.1.0
Composable content blocks for Node.js apps — flexible, pluggable, and framework-agnostic.
@codesled/content
/
src
/
blocks
/
createBlock.js
16 lines
(12 loc)
•
292 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
const
{ validateBlock } =
require
(
"./blockSchema"
);
function
createBlock
(
{
type
, content, meta = {} }
) {
const
block = {
type
, content, meta,
createdAt
:
new
Date
().
toISOString
(), };
validateBlock
(block);
return
block; }
module
.
exports
= createBlock;