BREAKING CHANGE(scope): switch to @pushrocks scope

This commit is contained in:
2018-08-27 02:01:18 +02:00
parent 5db9964480
commit 471b52c78e
10 changed files with 1034 additions and 464 deletions

View File

@@ -1,53 +1,33 @@
import 'typings-global'
let grayMatter = require('gray-matter')
import 'typings-global';
import * as grayMatter from 'gray-matter';
export type TFrontMatter = 'yaml' | 'json'
export interface IParsedFM {
data: any
content: string
orig: string
}
export type TFrontMatter = 'yaml' | 'json';
export interface ISmartfmContructorOptions {
fmType: TFrontMatter
fmType: TFrontMatter;
}
/**
* class smartfm handles frontmatter
*/
export class Smartfm {
fmType: TFrontMatter
fmType: TFrontMatter;
constructor(optionsArg: ISmartfmContructorOptions) {
this.fmType = optionsArg.fmType
this.fmType = optionsArg.fmType;
}
/**
* add frontmatter to a string
*/
stringify(bodyString: string, frontmatterData: any) {
return stringify(bodyString, frontmatterData)
return grayMatter.stringify(bodyString, frontmatterData);
}
/**
* parse a string that has frontmatter attached, YAML notation
*/
parse(stringToParse: string): IParsedFM {
return parse(stringToParse)
parse(stringToParse: string) {
return grayMatter(stringToParse);
}
}
/**
* parse a string that has frontmatter attached, YAML notation
*/
export let parse = (stringToParse: string): IParsedFM => {
return grayMatter(stringToParse)
}
/**
* add frontmatter to a string
*/
export let stringify = (bodyString: string, frontmatterData: any) => {
return grayMatter.stringify(bodyString, frontmatterData)
}