New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sphido/core

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sphido/core - npm Package Compare versions

Comparing version 2.0.10 to 2.0.11

4

package.json
{
"name": "@sphido/core",
"version": "2.0.10",
"version": "2.0.11",
"author": {

@@ -48,3 +48,3 @@ "name": "Roman Ožana",

},
"gitHead": "1b2b979b11792cce16e4f56d6fb003dc3a3b71fc"
"gitHead": "d242c810431b4070f81198c5266f54b72927ee19"
}

@@ -44,3 +44,3 @@ # @sphido/core

## Extend
## Extending `page` object

@@ -50,3 +50,3 @@ Every single `page` object inside structure can be modified with extender. Extenders are set as additional parameters of the `getPages()` function.

### *callback* extenders
### *Callback* extenders

@@ -64,3 +64,3 @@ Callback extender is a function that is called during recursion over each page with three

### *object* extenders
### *Object* extenders

@@ -82,11 +82,24 @@ This extender is just a simple JavaScript object that is combined with the `page` object using the [Object.assign()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) function.

const extenders = [
// callback extender will be called during iteration
// callback extenders will be called during iteration ony by one
(page) => {
// add property
page.title = `${page.name} | my best website`;
// or function
page.getDate = () => new Date();
// or something else
page.counter = 1;
},
// callback extenders are called in the series
(page) => {
page.counter++;
},
// object extender will be merged with page object
{

@@ -111,2 +124,3 @@ "author": "Roman Ožana",

"title": "Main page | my best website",
"counter": 2,
"author": "Roman Ožana",

@@ -137,21 +151,23 @@ "getDate": "[Function: getDate]",

function getHtml({name, content, path}) {
return `<!DOCTYPE html>
<html lang="cs" dir="ltr">
<head>
<meta charset="UTF-8">
<script src="https://cdn.tailwindcss.com?plugins=typography"></script>
<title>${name} | Sphido Example page</title>
</head>
<body class="prose mx-auto my-6">${content}</body>
<!-- Generated with Sphido from ${path} -->
</html>`;
}
const pages = await getPages({path: 'content'}, // ... extenders
(page) => {
page.slug = slugify(page.name) + '.html';
page.dir = dirname(page.path);
});
const pages = await getPages({path: 'content'});
for (const page of allPages(pages)) {
page.output = join('public', relative('content', dirname(page.path)), slugify(page.name) + '.html');
page.output = join('public', relative('content', page.dir), page.slug);
page.content = marked(await readFile(page.path));
await writeFile(page.output, getHtml(page));
await writeFile(page.output, `<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<script src="https://cdn.tailwindcss.com?plugins=typography"></script>
<title>${page.name} | Sphido Example</title>
</head>
<body class="prose mx-auto my-6">${page.content}</body>
<!-- Generated by Sphido from ${page.path} -->
</html>
`);
}

@@ -158,0 +174,0 @@ ```

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc