![38% of CISOs Fear They’re Not Moving Fast Enough on AI](https://cdn.sanity.io/images/cgdhsj6q/production/faa0bc28df98f791e11263f8239b34207f84b86f-1024x1024.webp?w=400&fit=max&auto=format)
Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
gatsby-transformer-javascript-frontmatter
Advanced tools
Gatsby transformer plugin for JavaScript to extract exports.frontmatter statically.
Parses JavaScript files to extract data from exports.
npm install --save gatsby-transformer-frontmatter
// In your gatsby-config.js
plugins: [`gatsby-transformer-javascript-frontmatter`];
This plugin uses babylon and traverse (from the babel family of code) to statically read the frontmatter exports.
In a .js file, export a frontmatter object to set your metadata variables, like so:
import React from 'react'
exports.frontmatter = {
title: 'Choropleth on d3v4',
written: '2017-05-04',
layoutType: 'post',
path: 'choropleth-on-d3v4',
category: 'data science',
description: 'Things about the choropleth.'
}
export default MyComponent ...
You can also use a named export for the data object:
export const frontmatter = {
title: "Choropleth on d3v4",
written: "2017-05-04",
layoutType: "post",
path: "choropleth-on-d3v4",
category: "data science",
description: "Things about the choropleth.",
};
You'd be able to query your data like:
{
allJavascriptFrontmatter {
edges {
node {
data {
error
path
title
written
category
description
updated
}
}
}
}
}
Which would return something like:
{
"data": {
"allJavascriptFrontmatter": {
"edges": [
{
"node": {
"data": {
"error": false,
"path": "choropleth-on-d3v4",
"title": "Choropleth on d3v4",
"written": "2017-05-04",
"category": "data science",
"description": "Things about the choropleth.",
"updated": null
}
}
}
]
}
}
}
Any attribute on "data" across your js files will be exported. If a file is missing it, the value will be null.
The error field will contain false
or an object with error information just to
give a surface level view of what the query is pulling out.
"error": {
"err": true,
"message": "we threw an error",
"stack": "This is a stringified stack trace"
},
FAQs
Gatsby transformer plugin for JavaScript to extract exports.frontmatter statically.
The npm package gatsby-transformer-javascript-frontmatter receives a total of 803 weekly downloads. As such, gatsby-transformer-javascript-frontmatter popularity was classified as not popular.
We found that gatsby-transformer-javascript-frontmatter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.