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

typal

Package Overview
Dependencies
Maintainers
1
Versions
88
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typal - npm Package Compare versions

Comparing version 1.19.0 to 1.19.1

5

build/lib/Property.js

@@ -139,3 +139,3 @@ const parse = require('@typedefs/parser');

toExtern(ws = '') {
const pp = []
let pp = []
if (this.description) {

@@ -153,3 +153,4 @@ let d = indentWithAster(this.description)

}
return pp.map(p => `${ws}${p}`).join('\n')
if (ws) pp = pp.map(p => `${ws}${p}`)
return pp.join('\n')
}

@@ -156,0 +157,0 @@ toParam(parentParam, ws = '', closure = false) {

10

build/lib/Template.js

@@ -28,3 +28,3 @@ const { Replaceable } = require('restream');

const type = types.find(({ fullName }) => fullName == n)
// also print location
// also print line:col location
if (!type) {

@@ -34,2 +34,6 @@ console.error('Type %s in %s not found', n, file)

}
if (pr == 'constructor') {
const lines = type.toHeading(ws)
return lines.join('\n')
}
const fn = type.properties.find(({ name }) => {

@@ -46,6 +50,2 @@ return name == pr

}
if (!fn.parsed.function) {
console.error('Property %s of type %s in %s is not a function.', pr, n, file)
return match
}
const lines = fn.toExtern(ws)

@@ -52,0 +52,0 @@ return lines

@@ -252,9 +252,10 @@ const extractTags = require('rexml');

}
/**
* Only used in externs.
* To heading above declaration bodies.
*/
toPrototype() {
const pp = []
if (this.description) pp.push(` * ${this.description}`)
if (this.extends) pp.push(` * @extends {${this.extends}}`)
toHeading(ws = '') {
let lines = []
if (this.description) lines.push(` * ${this.description}`)
if (this.extends) lines.push(` * @extends {${this.extends}}`)
if (this._args) this._args.forEach((s) => {

@@ -265,4 +266,12 @@ const { name, description, optional, type } = s

pp.push(` * @param {${type}${optional ? '=' : ''}} ${arg}${d}`)
lines.push(` * @param {${type}${optional ? '=' : ''}} ${arg}${d}`)
})
if (ws) lines = lines.map(p => `${ws}${p}`)
return lines
}
/**
* Only used in externs.
*/
toPrototype() {
const pp = this.toHeading()
const constr = this._args ? `function(${this._args.map(({ name }) => name)}) {}` : null

@@ -269,0 +278,0 @@ pp.push(` * @${this.prototypeAnnotation}`)

## 1 August 2019
### [1.19.1](https://github.com/artdecocode/typal/compare/v1.19.0...v1.19.1)
- [fix] Allow to template constructor methods and properties.
### [1.19.0](https://github.com/artdecocode/typal/compare/v1.18.0...v1.19.0)

@@ -4,0 +8,0 @@

@@ -775,3 +775,3 @@ #!/usr/bin/env node

function mb(a, b = "") {
const c = [];
let c = [];
if (a.description) {

@@ -783,3 +783,4 @@ let d = kb(a.description);

a.b && "function" == a.b.name ? (a = lb(a), c.push(...a)) : c.push(` * @type {${a.optional ? Xa(a.g) : a.g}}`);
return c.map(d => `${b}${d}`).join("\n");
b && (c = c.map(d => `${b}${d}`));
return c.join("\n");
}

@@ -889,3 +890,3 @@ function nb(a, b) {

});
const zb = T("function", b), Ab = T("fn", b);
const Ab = T("function", b), Bb = T("fn", b);
b = T("static", b).map(r => {

@@ -895,5 +896,5 @@ r.isStatic = !0;

});
b = [...zb, ...Ab, ...b].map(r => {
var {content:Y, u:z, isStatic:Bb} = r;
const {V:Cb, K:Z} = gb(Y);
b = [...Ab, ...Bb, ...b].map(r => {
var {content:Y, u:z, isStatic:Cb} = r;
const {V:Db, K:Z} = gb(Y);
var B = Object.assign({}, z);

@@ -904,5 +905,5 @@ r = z.async;

let {args:aa = ""} = z;
!aa && Z.length && (aa = Z.map(Db => {
var {type:xa, optional:Eb} = Db;
return null !== Eb ? `${xa}=` : xa;
!aa && Z.length && (aa = Z.map(Eb => {
var {type:xa, optional:Fb} = Eb;
return null !== Fb ? `${xa}=` : xa;
}).join(","));

@@ -912,4 +913,4 @@ N = N.replace(/\n\s*/g, " ");

r = new ob(Z);
hb(r, Cb, B);
Bb && (r.o = !0);
hb(r, Db, B);
Cb && (r.o = !0);
return r;

@@ -922,50 +923,43 @@ });

function pb(a) {
const b = [];
a.description && b.push(` * ${a.description}`);
a.extends && b.push(` * @extends {${a.extends}}`);
a.b && a.b.forEach(e => {
const {name:f, description:g, optional:h, type:k} = e;
b.push(` * @param {${k}${h ? "=" : ""}} ${h ? `[${f}]` : f}${g ? ` ${g}` : ""}`);
});
var c = a.b ? `function(${a.b.map(e => {
({name:e} = e);
return e;
var b = qb(a), c = a.b ? `function(${a.b.map(d => {
({name:d} = d);
return d;
})}) {}` : null;
b.push(` * @${a.U}`);
let d = `/**
b = `/**
${b.join("\n")}
*/
`;
d += Q(a.j, a.name, c);
c = a.i.reduce((e, f) => {
e.push(f);
const g = f.A.map(h => nb(f, h));
e.push(...g);
return e;
}, []).map(e => {
let f = mb(e);
f = `/**
${f}
b += Q(a.j, a.name, c);
c = a.i.reduce((d, e) => {
d.push(e);
const f = e.A.map(g => nb(e, g));
d.push(...f);
return d;
}, []).map(d => {
let e = mb(d);
e = `/**
${e}
*/
` + Q(`${a.h}${e.o ? "" : ".prototype"}`, e.name);
if (e.b && "function" == e.b.name) {
var {function:{args:g}} = e.b;
g = g.map((h, k) => {
({name:h = `arg${k}`} = e.args[k] || {});
return h;
` + Q(`${a.h}${d.o ? "" : ".prototype"}`, d.name);
if (d.b && "function" == d.b.name) {
var {function:{args:f}} = d.b;
f = f.map((g, h) => {
({name:g = `arg${h}`} = d.args[h] || {});
return g;
});
f += ` = function(${g.join(", ")}) {}`;
e += ` = function(${f.join(", ")}) {}`;
} else {
e.type.startsWith("function(") && (f += " = function() {}");
d.type.startsWith("function(") && (e += " = function() {}");
}
return f;
return e;
});
return [d, ...c].join("\n");
return [b, ...c].join("\n");
}
function qb(a, b) {
function rb(a, b) {
const c = `${a.extends ? "$" : ""}${a.name}`;
return b ? `${a.w}${c}` : c;
}
function rb(a, b, c) {
var d = ` * @typedef {${(b ? a.g : a.type) || "Object"}}${` ${qb(a, b)}${a.o}`}`;
function sb(a, b, c) {
var d = ` * @typedef {${(b ? a.g : a.type) || "Object"}}${` ${rb(a, b)}${a.o}`}`;
a = (a.i ? a.i.reduce((e, f) => {

@@ -984,6 +978,6 @@ e.push(f);

}
function sb(a, b, c) {
function tb(a, b, c) {
b = void 0 === b ? !1 : b;
c = void 0 === c ? !1 : c;
const d = !!a.extends, e = rb(a, b, c), f = [];
const d = !!a.extends, e = sb(a, b, c), f = [];
if (a.j && b) {

@@ -998,3 +992,3 @@ let g = ` * @typedef {${a.h}} ${a.name}${a.o}`;

}
d && (a = ` * @typedef {${a.extends} & ${qb(a, b)}} ${b ? a.h : a.name}${a.o}`, b && !c && (a = P(a)), a = `/**
d && (a = ` * @typedef {${a.extends} & ${rb(a, b)}} ${b ? a.h : a.name}${a.o}`, b && !c && (a = P(a)), a = `/**
${a}

@@ -1006,2 +1000,14 @@ */

}
function qb(a, b) {
b = void 0 === b ? "" : b;
let c = [];
a.description && c.push(` * ${a.description}`);
a.extends && c.push(` * @extends {${a.extends}}`);
a.b && a.b.forEach(d => {
const {name:e, description:f, optional:g, type:h} = d;
c.push(` * @param {${h}${g ? "=" : ""}} ${g ? `[${e}]` : e}${f ? ` ${f}` : ""}`);
});
b && (c = c.map(d => `${b}${d}`));
return c;
}
class W {

@@ -1043,3 +1049,3 @@ constructor() {

d = this.description ? ` ${this.description}` : "";
const g = this.M ? tb(this.i) : e ? this.h : this.name;
const g = this.M ? ub(this.i) : e ? this.h : this.name;
b = `${c || ""} * @param {${f}${g}} ${b ? `[${a}]` : a}${d}`;

@@ -1050,3 +1056,3 @@ f = this.i && !this.L ? this.i.map(h => h.J(a, c, e)) : [];

}
const tb = (a, b) => {
const ub = (a, b) => {
a = void 0 === a ? [] : a;

@@ -1067,3 +1073,3 @@ b = void 0 === b ? !1 : b;

};
function ub(a, {name:b, from:c, desc:d, link:e, ns:f}) {
function vb(a, {name:b, from:c, desc:d, link:e, ns:f}) {
a.name = b;

@@ -1075,6 +1081,6 @@ a.from = c;

}
function vb(a, b = !0) {
function wb(a, b = !0) {
return ` * @typedef {import('${a.from}').${a.name}} ${b ? a.h : a.name}`;
}
class wb {
class xb {
constructor() {

@@ -1088,7 +1094,7 @@ this.from = this.name = this.w = "";

}
;function xb(a, b) {
;function yb(a, b) {
b = b.reduce((c, d) => Object.assign({}, c, {[d.h]:d}), {});
a.F = Object.assign({}, a.F, b);
}
class yb extends L {
class zb extends L {
constructor(a, b) {

@@ -1099,3 +1105,3 @@ b = void 0 === b ? {} : b;

this.on("types", c => {
xb(this, c);
yb(this, c);
});

@@ -1115,3 +1121,3 @@ this.on("namespace", c => {

static get b() {
return wb;
return xb;
}

@@ -1122,3 +1128,3 @@ get types() {

}
;const Fb = a => {
;const Gb = a => {
a = T("types", a);

@@ -1146,5 +1152,5 @@ if (!a.length) {

f = T("import", b).map(({u:h, content:k}) => {
const l = new wb;
const l = new xb;
k && (h.desc = R(k));
ub(l, h);
vb(l, h);
return l;

@@ -1158,5 +1164,5 @@ });

return {j:d, types:a, imports:f, X:g};
}, Gb = async(a, b = []) => {
}, Hb = async(a, b = []) => {
a = await E(a);
let {j:c = null, types:d, imports:e} = Fb(a);
let {j:c = null, types:d, imports:e} = Gb(a);
d = d.filter(({h:f}) => b.includes(f) ? !1 : !0);

@@ -1166,6 +1172,6 @@ e = e.filter(({h:f}) => b.includes(f) ? !1 : !0);

};
const Hb = (a, b, c) => {
b = b.map(d => sb(d, !0, c));
const Ib = (a, b, c) => {
b = b.map(d => tb(d, !0, c));
a = a.map(d => {
d = vb(d);
d = wb(d);
return `/**

@@ -1177,7 +1183,7 @@ ${c ? d : P(d)}

return [...b, ...a].join("");
}, Ib = (a, b, c, d = !1) => {
}, Jb = (a, b, c, d = !1) => {
a = [...a.map(e => {
{
let f;
e.g ? f = ` * @typedef {${e.g}}` : e.W || (f = ` * @typedef {${tb(e.i, !0)}}`);
e.g ? f = ` * @typedef {${e.g}}` : e.W || (f = ` * @typedef {${ub(e.i, !0)}}`);
f ? (e.description && (f = ` * ${e.description}\n${f}`), f = `/**

@@ -1194,3 +1200,3 @@ ${f}

};
const Kb = {re:/^\/\*\*? (documentary|typal) (.+?) \*\/\n(?:([^\n][\s\S]+?\n))?$/mg, replacement:async function(a, b, c) {
const Lb = {re:/^\/\*\*? (documentary|typal) (.+?) \*\/\n(?:([^\n][\s\S]+?\n))?$/mg, replacement:async function(a, b, c) {
const [d, ...e] = c.split(/\s+/), f = e.includes("closure"), g = e.includes("externs"), h = e.includes("noSuppress"), k = e.includes("skipNsDecl");

@@ -1204,7 +1210,7 @@ let l = e.find(p => p.startsWith("ignore:"));

this.m("Detected type marker: %s", c);
const {types:p, imports:q, j:t} = await Gb(d, l);
const {types:p, imports:q, j:t} = await Hb(d, l);
this.emit("types", p);
this.emit("types", q);
let u;
m ? u = Hb(q, p, h) : n ? (u = Ib(p, t, this.b, k) + "\n", t && this.emit("namespace", t)) : u = Jb(q, p);
m ? u = Ib(q, p, h) : n ? (u = Jb(p, t, this.b, k) + "\n", t && this.emit("namespace", t)) : u = Kb(q, p);
return `/* ${b} ${c} */\n${u}`;

@@ -1214,10 +1220,10 @@ } catch (p) {

}
}}, Jb = (a, b) => {
b = b.map(c => sb(c));
a = a.map(c => vb(c, !1)).map(Ya).join("");
}}, Kb = (a, b) => {
b = b.map(c => tb(c));
a = a.map(c => wb(c, !1)).map(Ya).join("");
b = b.join("");
return `${a}${b}`.replace(Lb, " * @typedef");
}, Lb = / \*\/\n\/\*\*\n \* @typedef/g;
const Nb = {re:/( *) \* @param {(.+?)} (\[)?([^\s\]]+)\]?(?: .+)?((?:\n(?: +)\* @param {(?:.+?)} \[?\4\]?.*)*)/gm, replacement:Mb};
function Mb(a, b, c, d, e, f, g) {
return `${a}${b}`.replace(Mb, " * @typedef");
}, Mb = / \*\/\n\/\*\*\n \* @typedef/g;
const Ob = {re:/( *) \* @param {(.+?)} (\[)?([^\s\]]+)\]?(?: .+)?((?:\n(?: +)\* @param {(?:.+?)} \[?\4\]?.*)*)/gm, replacement:Nb};
function Nb(a, b, c, d, e, f, g) {
const {D:h} = this.l;

@@ -1252,3 +1258,3 @@ let k;

c = Object.values(this.types).find(({name:m, h:n}) => h ? n == k.name : m == k.name);
return !c || c instanceof yb.b ? a : c.J(e, d, b, k.nullable, h);
return !c || c instanceof zb.b ? a : c.J(e, d, b, k.nullable, h);
}

@@ -1261,3 +1267,3 @@ const X = (a, b, c, d, e) => {

let h = b.includes(f);
h || (h = Ob.includes(f));
h || (h = Pb.includes(f));
if (h) {

@@ -1281,10 +1287,10 @@ return !0;

}
}, Ob = "String Boolean Object Date Number Symbol Buffer Function".split(" ");
var Pb = (a, b = !1) => {
}, Pb = "String Boolean Object Date Number Symbol Buffer Function".split(" ");
var Qb = (a, b = !1) => {
var {T:c} = Qa();
const d = Sa(c);
c = Ra(c);
return new yb(b ? [Kb] : [Kb, d, Nb, c], a);
return new zb(b ? [Lb] : [Lb, d, Ob, c], a);
};
var Rb = async() => {
var Sb = async() => {
const {D:a = !1, H:b = !1, B:c, types:d} = {D:ka, H:la, B:ja, types:ma};

@@ -1295,10 +1301,10 @@ await Promise.all(w.map(async e => {

f.isFile() ? g = [e] : f.isDirectory() && (f = await I(e), g = J(f.content, e));
await Qb(g, a, b, c, d);
await Rb(g, a, b, c, d);
}));
};
const Qb = async(a, b = !1, c = !1, d = null, e = null) => {
const Rb = async(a, b = !1, c = !1, d = null, e = null) => {
const f = [];
e && await Promise.all(e.split(",").map(async g => {
g = await E(g);
const {types:h, imports:k} = Fb(g);
const {types:h, imports:k} = Gb(g);
f.push(h, k);

@@ -1308,3 +1314,3 @@ }));

var h = await E(g);
const k = Pb({D:b, H:c}, c);
const k = Qb({D:b, H:c}, c);
f.forEach(l => k.emit("types", l));

@@ -1319,7 +1325,7 @@ k.file = g;

};
const Sb = a => {
const Tb = a => {
let b;
"true" == a ? b = !0 : "false" == a ? b = !1 : /^\d+$/.test(a) && (b = parseInt(a, 10));
return void 0 !== b ? b : a;
}, Tb = /^ \* @prop {(.+?)} (\[)?(.+?)(?:=(["'])?(.+?)\4)?(?:])?(?: (.+?))?(?: Default `(.+?)`.)?$/gm, Ub = "type opt name quote defaultValue description Default".split(" "), Va = new RegExp(`^ \\* @typedef {(.+?)} (.+?)(?: (.+))?\\n((?:${/ \* @prop(?:erty)? .+\n/.source})*)`, "gm"), Vb = (a, b, c, d) => {
}, Ub = /^ \* @prop {(.+?)} (\[)?(.+?)(?:=(["'])?(.+?)\4)?(?:])?(?: (.+?))?(?: Default `(.+?)`.)?$/gm, Vb = "type opt name quote defaultValue description Default".split(" "), Va = new RegExp(`^ \\* @typedef {(.+?)} (.+?)(?: (.+))?\\n((?:${/ \* @prop(?:erty)? .+\n/.source})*)`, "gm"), Wb = (a, b, c, d) => {
d = d.length;

@@ -1330,3 +1336,3 @@ a = a && "Object" != a ? ` type="${a}"` : "";

};
class Wb extends y {
class Xb extends y {
constructor() {

@@ -1337,3 +1343,3 @@ super({writableObjectMode:!0});

var {type:d, name:e, description:f, i:g} = a;
a = d && d.startsWith("import") ? Xb(d, e) : Vb(d, e, f, g);
a = d && d.startsWith("import") ? Yb(d, e) : Wb(d, e, f, g);
this.push(a);

@@ -1356,3 +1362,3 @@ g.forEach(h => {

}
const Xb = (a, b) => {
const Yb = (a, b) => {
const c = /import\((['"])(.+?)\1\)/.exec(a);

@@ -1365,3 +1371,3 @@ if (!c) {

};
class Yb extends y {
class Zb extends y {
constructor() {

@@ -1372,3 +1378,3 @@ super({objectMode:!0});

var [, d, e, f, g] = a;
a = S(Tb, g, Ub).map(h => {
a = S(Ub, g, Vb).map(h => {
var k = Object.assign({}, h), l = h.defaultValue;

@@ -1380,3 +1386,3 @@ const m = h.Default;

k = (delete k.defaultValue, delete k.Default, delete k.opt, delete k.name, delete k.type, k);
n = Object.assign({}, k, {name:p, type:h}, l ? {defaultValue:Sb(l)} : {}, m ? {C:Sb(m)} : {}, n ? {optional:!0} : {});
n = Object.assign({}, k, {name:p, type:h}, l ? {defaultValue:Tb(l)} : {}, m ? {C:Tb(m)} : {}, n ? {optional:!0} : {});
if (l || m) {

@@ -1391,4 +1397,4 @@ l ? l !== m && void 0 !== n.C && (l = O(p, m, h), console.error("%s[%s] does not match Default `%s`.", e, l, n.C)) : (l = O(p, m, h), console.error("%s[%s] got from Default.", e, l)), n.default = "defaultValue" in n ? n.defaultValue : n.C, delete n.defaultValue, delete n.C;

}
async function Zb(a) {
const b = Ua(), c = new Yb, d = new Wb;
async function $b(a) {
const b = Ua(), c = new Zb, d = new Xb;
b.pipe(c).pipe(d);

@@ -1412,14 +1418,14 @@ b.end(a);

}
;var $b = async() => {
;var ac = async() => {
const {B:a} = {B:ja};
await Promise.all(w.map(async b => {
b = await E(b);
b = await Zb(b);
b = await $b(b);
a ? await F(a, b) : console.log(b);
}));
};
const ac = /( *) \* @fnType {(.+?)}/gm;
class bc extends L {
const bc = /( *) \* @fnType {(.+?)}/gm;
class cc extends L {
constructor(a, b) {
super([{re:ac, async replacement(c, d, e) {
super([{re:bc, async replacement(c, d, e) {
e = e.split(".");

@@ -1440,8 +1446,11 @@ let f, g;

}
if ("constructor" == g) {
return qb(e, d).join("\n");
}
e = e.i.find(({name:h}) => h == g);
return e ? e.b ? e.b.function ? mb(e, d) : (console.error("Property %s of type %s in %s is not a function.", g, f, b), c) : (console.error("Property %s of type %s in %s wasn't parsed, possibly parser bug.", g, f, b), c) : (console.error("Property %s of type %s in %s not found", g, f, b), c);
return e ? e.b ? mb(e, d) : (console.error("Property %s of type %s in %s wasn't parsed, possibly parser bug.", g, f, b), c) : (console.error("Property %s of type %s in %s not found", g, f, b), c);
}}]);
}
}
;const cc = async a => {
;const dc = async a => {
if (!a) {

@@ -1457,4 +1466,4 @@ return [];

return c;
}, dc = async a => (await Promise.all(a.map(async b => {
const c = await Gb(b);
}, ec = async a => (await Promise.all(a.map(async b => {
const c = await Hb(b);
return Object.assign({}, c, {location:b});

@@ -1467,8 +1476,8 @@ }))).reduce((b, c) => {

}, []);
async function ec() {
async function fc() {
var a = {B:na, types:ma};
a = void 0 === a ? {} : a;
const {B:b, types:c} = a;
a = await cc(c);
const d = await dc(a);
a = await dc(c);
const d = await ec(a);
await Promise.all(w.map(async e => {

@@ -1478,6 +1487,6 @@ var f = await G(x, e);

f.isFile() ? g = [e] : f.isDirectory() && (f = await I(e), g = J(f.content, e));
await fc(g, d, b);
await gc(g, d, b);
}));
}
const fc = async(a, b, c) => {
const gc = async(a, b, c) => {
b = void 0 === b ? [] : b;

@@ -1487,3 +1496,3 @@ c = void 0 === c ? null : c;

var e = await E(d);
const f = new bc(b, d);
const f = new cc(b, d);
f.end(e);

@@ -1503,3 +1512,3 @@ e = await D(f);

try {
return oa ? await $b() : na ? await ec() : await Rb();
return oa ? await ac() : na ? await fc() : await Sb();
} catch (a) {

@@ -1506,0 +1515,0 @@ process.env.DEBUG ? console.log(a.stack) : console.log(a.message);

{
"name": "typal",
"version": "1.19.0",
"version": "1.19.1",
"description": "Organises TypeDefs By Placing Them Into Types.Xml File To Be Embedded Into Source Code Compatible With VSCode And Google Closure Compiler, Generates Externs And Allows To Place Documentation In README Markdown.",

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

@@ -139,3 +139,3 @@ import parse from '@typedefs/parser'

toExtern(ws = '') {
const pp = []
let pp = []
if (this.description) {

@@ -153,3 +153,4 @@ let d = indentWithAster(this.description)

}
return pp.map(p => `${ws}${p}`).join('\n')
if (ws) pp = pp.map(p => `${ws}${p}`)
return pp.join('\n')
}

@@ -156,0 +157,0 @@ toParam(parentParam, ws = '', closure = false) {

@@ -28,3 +28,3 @@ import { Replaceable } from 'restream'

const type = types.find(({ fullName }) => fullName == n)
// also print location
// also print line:col location
if (!type) {

@@ -34,2 +34,6 @@ console.error('Type %s in %s not found', n, file)

}
if (pr == 'constructor') {
const lines = type.toHeading(ws)
return lines.join('\n')
}
const fn = type.properties.find(({ name }) => {

@@ -46,6 +50,2 @@ return name == pr

}
if (!fn.parsed.function) {
console.error('Property %s of type %s in %s is not a function.', pr, n, file)
return match
}
const lines = fn.toExtern(ws)

@@ -52,0 +52,0 @@ return lines

@@ -252,9 +252,10 @@ import extractTags from 'rexml'

}
/**
* Only used in externs.
* To heading above declaration bodies.
*/
toPrototype() {
const pp = []
if (this.description) pp.push(` * ${this.description}`)
if (this.extends) pp.push(` * @extends {${this.extends}}`)
toHeading(ws = '') {
let lines = []
if (this.description) lines.push(` * ${this.description}`)
if (this.extends) lines.push(` * @extends {${this.extends}}`)
if (this._args) this._args.forEach((s) => {

@@ -265,4 +266,12 @@ const { name, description, optional, type } = s

pp.push(` * @param {${type}${optional ? '=' : ''}} ${arg}${d}`)
lines.push(` * @param {${type}${optional ? '=' : ''}} ${arg}${d}`)
})
if (ws) lines = lines.map(p => `${ws}${p}`)
return lines
}
/**
* Only used in externs.
*/
toPrototype() {
const pp = this.toHeading()
const constr = this._args ? `function(${this._args.map(({ name }) => name)}) {}` : null

@@ -269,0 +278,0 @@ pp.push(` * @${this.prototypeAnnotation}`)

Sorry, the diff of this file is not supported yet

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