Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

parse-yuf

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parse-yuf

Parse front matter extracted from yufrontin

  • 0.1.13
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

parse-yuf

NPM version schoolmarm-standard-style experimental Downloads

Parse front matter extracted from yufrontin

Installation

$ npm install parse-yuf

Usage

file: kmx/test/one.hbs

---
title: one
layout: default
description: This is a test. This is only a test
tags: ['apple', 'orange', 'pear']
---

This is one.

extended options: sync and async versions

var parsefm = require('parse-yuf')

var syncExtend = parsefm.sync('kmx/test/one.hbs', {extend: true})
console.log(syncExtend)
// or
parsefm('kmx/test/one.hbs', {extend: true}, function (err, res) {
  assert.ifError(err)
  console.log(res)
})

// results in -->
{ abs: '/Volumes/BigStor/Developer/web/sites/testproj949/kmx/test/one.hbs',
  rel: 'kmx/test/one.hbs',
  file:
   { root: 'testproj949',
     dir: 'kmx/test',
     base: 'one.hbs',
     ext: '.hbs',
     name: 'one' },
  stats:
   { dev: 16777242,
     mode: 33188,
     nlink: 1,
     uid: 501,
     gid: 20,
     rdev: 0,
     blksize: 4096,
     ino: 3441487,
     size: 137,
     blocks: 16,
     atime: Thu Sep 17 2015 09:22:26 GMT-0400 (EDT),
     mtime: Tue Sep 15 2015 12:33:08 GMT-0400 (EDT),
     ctime: Tue Sep 15 2015 12:33:08 GMT-0400 (EDT),
     birthtime: Tue Sep 01 2015 17:02:30 GMT-0400 (EDT) },
  data:
   { title: 'one',
     layout: 'default',
     description: 'This is a test. This is only a test',
     tags: [ 'apple', 'orange', 'pear' ] },
  content: '\nThis is one.\n' }

vanilla readFile sync and async versions:

var syncPlain = parsefm.sync('kmx/test/one.hbs')
console.log(syncPlain)
// or
parsefm('kmx/test/one.hbs', function (err, res) {
  assert.ifError(err)
  console.log(res)
})

// results in -->
{ data:
   { title: 'one',
     layout: 'default',
     description: 'This is a test. This is only a test',
     tags: [ 'apple', 'orange', 'pear' ] },
  content: '\nThis is one.\n' }

API

parse(filepath[, options], callback)
parse.sync(filepath[, options])

Why?

See Also

License

ISC

Keywords

FAQs

Package last updated on 20 Sep 2015

Did you know?

Socket

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.

Install

Related posts

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