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

@condenast/ember-docs

Package Overview
Dependencies
Maintainers
280
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@condenast/ember-docs - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

tests/fixtures/classic/app/components/variable-export-component.js

2

package.json
{
"name": "@condenast/ember-docs",
"version": "0.1.3",
"version": "0.1.4",
"description": "Creates documentation from Ember apps / addons",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -8,2 +8,3 @@ const commonmark = require('commonmark');

let positionalParams = staticProperties.find(property => property.key.name === 'positionalParams');
if (positionalParams) {

@@ -21,5 +22,25 @@ if (positionalParams.value.type === 'ArrayExpression') {

let positionalParams = getPositionalParameters(ast, component);
let parameters = utils.getProperties(ast);
let positional = parameters.filter(param => {
return positionalParams.indexOf(param.key.name) !== -1;
}).map(param => {
let comment = (param.leadingComments || []).find((comment) => {
return comment.type === 'CommentBlock';
});
let doc = doctrine.parse(comment.value, { unwrap: false, recoverable: true });
let property = doc.tags.find(tag => tag.title === 'property') || {};
let type = property.type;
if (type) {
type = type.name;
}
return {
name: param.key.name,
description: utils.markdown(doc.description || ''),
type
}
});
return {
positional: [],
positional,
named: []

@@ -26,0 +47,0 @@ };

@@ -72,3 +72,3 @@ /**

// Pod components
if (name.match(/component$/)) {
if (name.match(/\/component$/)) {
name = name.match(/(.*)\/component$/)[1];

@@ -75,0 +75,0 @@ }

@@ -169,5 +169,10 @@ const _ = require('lodash');

let properties = [];
let callExpression = main;
if (main.type === 'CallExpression') {
main.arguments.filter(arg => arg.type === 'ObjectExpression').forEach(body => {
if (main.type === 'VariableDeclarator') {
callExpression = main.init;
}
if (callExpression.type === 'CallExpression') {
callExpression.arguments.filter(arg => arg.type === 'ObjectExpression').forEach(body => {
body.properties.filter(property => property.type === 'ObjectProperty').forEach(property => {

@@ -233,3 +238,3 @@ properties.push(property);

*/
if (dfn.callee.property && dfn.callee.property.name === 'reopenClass') {
if (dfn.callee && dfn.callee.property && dfn.callee.property.name === 'reopenClass') {
staticProperties = staticProperties.concat(

@@ -236,0 +241,0 @@ dfn.arguments[0].properties.filter((property) => property.type === 'ObjectProperty')

@@ -18,2 +18,20 @@ const parse = require('../../index');

test('variable-export-component', () => {
let component = parse(path.resolve(__dirname, '../fixtures/classic/app/components/variable-export-component.js'), {});
expect(component.name).toBe('variable-export-component');
expect(component.access).toBe('public');
expect(component.description).toEqual([
'<p>This is my component that got reexported as a variable</p>\n'
]);
expect(component.parameters).toEqual({
named: [],
positional: [{
name: 'first',
description: ['<p>This is the first param</p>\n'],
type: 'string'
}]
});
});
describe('pods', () => {

@@ -20,0 +38,0 @@ test('text-field', () => {

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