get-annotation
v1.1.0
Published
从源码中解析注解字段
Downloads
9
Readme
get-annotation
从源码中解析注解字段
const body = `
/*
*
* @entry
*
* @path: /a/b-c/hello
*
* @lessbuild: false
*
* @ignore: true
*
* @webpack.entry
*
* @server.url: http://www.google.com
*
* @count: 1234
* @price: 12.34
*/
...some code
`
const getAnnotation = require('get-annotation');
getAnnotation(body, 'entry') // true
getAnnotation(body, 'path') // '/a/b-c/hello'
getAnnotation(body, 'lessbuild') // false
getAnnotation(body, 'ignore') // true
getAnnotation(body, 'webpack.entry') // true
getAnnotation(body, 'server.url') // 'http://www.google.com'
getAnnotation(body, 'count') // 1234
getAnnotation(body, 'price') // 12.34