docworks-model
Advanced tools
Comparing version 1.3.2 to 1.3.11
'use strict'; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
value: true | ||
}); | ||
@@ -20,16 +20,17 @@ exports.Service = Service; | ||
exports.JsDocError = JsDocError; | ||
function Service(name, memberOf, mixes, labels, properties, operations, callbacks, messages, location, docs, srcDocs) { | ||
return { | ||
name: name, | ||
memberOf: memberOf, | ||
mixes: mixes, | ||
labels: labels, | ||
properties: properties, | ||
operations: operations, | ||
callbacks: callbacks, | ||
messages: messages, | ||
location: location, | ||
docs: docs, | ||
srcDocs: srcDocs | ||
}; | ||
function Service(name, memberOf, mixes, labels, properties, operations, callbacks, messages, location, docs, srcDocs, extra) { | ||
return { | ||
name: name, | ||
memberOf: memberOf, | ||
mixes: mixes, | ||
labels: labels, | ||
properties: properties, | ||
operations: operations, | ||
callbacks: callbacks, | ||
messages: messages, | ||
location: location, | ||
docs: docs, | ||
srcDocs: srcDocs, | ||
extra: extra || {} | ||
}; | ||
} | ||
@@ -41,122 +42,125 @@ | ||
function Docs(summary, description, links, examples) { | ||
return { | ||
summary: summary, | ||
description: description, | ||
links: links, | ||
examples: examples | ||
}; | ||
return { | ||
summary: summary, | ||
description: description, | ||
links: links, | ||
examples: examples | ||
}; | ||
} | ||
function Example(title, body) { | ||
return { | ||
title: title, | ||
body: body | ||
}; | ||
return { | ||
title: title, | ||
body: body | ||
}; | ||
} | ||
function Return(type, doc, srcDoc) { | ||
return { | ||
type: type, | ||
doc: doc, | ||
srcDoc: srcDoc | ||
}; | ||
return { | ||
type: type, | ||
doc: doc, | ||
srcDoc: srcDoc | ||
}; | ||
} | ||
function Operation(name, labels, nameParams, params, ret, locations, docs, srcDocs) { | ||
return { | ||
name: name, | ||
nameParams: nameParams, | ||
labels: labels, | ||
params: params, | ||
ret: ret, | ||
locations: locations, | ||
docs: docs, | ||
srcDocs: srcDocs | ||
}; | ||
function Operation(name, labels, nameParams, params, ret, locations, docs, srcDocs, extra) { | ||
return { | ||
name: name, | ||
nameParams: nameParams, | ||
labels: labels, | ||
params: params, | ||
ret: ret, | ||
locations: locations, | ||
docs: docs, | ||
srcDocs: srcDocs, | ||
extra: extra || {} | ||
}; | ||
} | ||
function Param(name, type, doc, srcDoc, optional, defaultValue, spread) { | ||
return { | ||
name: name, | ||
type: type, | ||
doc: doc, | ||
srcDoc: srcDoc, | ||
optional: optional, | ||
defaultValue: defaultValue, | ||
spread: spread | ||
}; | ||
return { | ||
name: name, | ||
type: type, | ||
doc: doc, | ||
srcDoc: srcDoc, | ||
optional: optional, | ||
defaultValue: defaultValue, | ||
spread: spread | ||
}; | ||
} | ||
function Property(name, labels, isGet, isSet, type, locations, docs, srcDocs) { | ||
return { | ||
name: name, | ||
labels: labels, | ||
get: isGet, | ||
set: isSet, | ||
type: type, | ||
locations: locations, | ||
docs: docs, | ||
srcDocs: srcDocs | ||
}; | ||
function Property(name, labels, isGet, isSet, type, locations, docs, srcDocs, extra) { | ||
return { | ||
name: name, | ||
labels: labels, | ||
get: isGet, | ||
set: isSet, | ||
type: type, | ||
locations: locations, | ||
docs: docs, | ||
srcDocs: srcDocs, | ||
extra: extra || {} | ||
}; | ||
} | ||
function Message(name, labels, members, locations, docs, srcDocs) { | ||
return { | ||
name: name, | ||
labels: labels, | ||
members: members, | ||
locations: locations, | ||
docs: docs, | ||
srcDocs: srcDocs | ||
}; | ||
function Message(name, labels, members, locations, docs, srcDocs, extra) { | ||
return { | ||
name: name, | ||
labels: labels, | ||
members: members, | ||
locations: locations, | ||
docs: docs, | ||
srcDocs: srcDocs, | ||
extra: extra || {} | ||
}; | ||
} | ||
function MessageMember(name, type, docs, srcDocs) { | ||
return { | ||
name: name, | ||
type: type, | ||
docs: docs, | ||
srcDocs: srcDocs | ||
}; | ||
return { | ||
name: name, | ||
type: type, | ||
docs: docs, | ||
srcDocs: srcDocs | ||
}; | ||
} | ||
function AtomicType(name) { | ||
return name; | ||
return name; | ||
} | ||
function UnionType(names) { | ||
return names; | ||
return names; | ||
} | ||
function GeneticType(name, typeParams) { | ||
return { | ||
name: name, | ||
typeParams: typeParams | ||
}; | ||
return { | ||
name: name, | ||
typeParams: typeParams | ||
}; | ||
} | ||
function Location(filename, lineno) { | ||
return { | ||
filename: filename, | ||
lineno: lineno | ||
}; | ||
return { | ||
filename: filename, | ||
lineno: lineno | ||
}; | ||
} | ||
function JsDocError(message, locations) { | ||
var groupByFile = function groupByFile(groups, location) { | ||
if (groups[location.filename]) groups[location.filename].push(location);else groups[location.filename] = [location]; | ||
return groups; | ||
}; | ||
var groupByFile = function groupByFile(groups, location) { | ||
if (groups[location.filename]) groups[location.filename].push(location);else groups[location.filename] = [location]; | ||
return groups; | ||
}; | ||
var files = locations.reduce(groupByFile, {}); | ||
var fileLocations = Object.keys(files).map(function (group) { | ||
var linenos = files[group].map(function (location) { | ||
return location.lineno; | ||
}); | ||
return group + ' (' + linenos.join(", ") + ')'; | ||
}).join(", "); | ||
return { | ||
message: message, | ||
location: fileLocations | ||
}; | ||
var files = locations.reduce(groupByFile, {}); | ||
var fileLocations = Object.keys(files).map(function (group) { | ||
var linenos = files[group].map(function (location) { | ||
return location.lineno; | ||
}); | ||
return group + ' (' + linenos.join(", ") + ')'; | ||
}).join(", "); | ||
return { | ||
message: message, | ||
location: fileLocations | ||
}; | ||
} |
{ | ||
"name": "docworks-model", | ||
"version": "1.3.2", | ||
"version": "1.3.11", | ||
"description": "The model objects for docworks json files", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
210
src/index.js
export function Service(name, memberOf, mixes, labels, properties, operations, callbacks, messages, location, docs, srcDocs) { | ||
return { | ||
name: name, | ||
memberOf: memberOf, | ||
mixes: mixes, | ||
labels: labels, | ||
properties: properties, | ||
operations: operations, | ||
callbacks: callbacks, | ||
messages: messages, | ||
location: location, | ||
docs: docs, | ||
srcDocs: srcDocs | ||
} | ||
export function Service(name, memberOf, mixes, labels, properties, operations, callbacks, messages, location, docs, srcDocs, extra) { | ||
return { | ||
name: name, | ||
memberOf: memberOf, | ||
mixes: mixes, | ||
labels: labels, | ||
properties: properties, | ||
operations: operations, | ||
callbacks: callbacks, | ||
messages: messages, | ||
location: location, | ||
docs: docs, | ||
srcDocs: srcDocs, | ||
extra: extra || {} | ||
} | ||
} | ||
@@ -23,125 +24,128 @@ | ||
export function Docs(summary, description, links, examples) { | ||
return { | ||
summary: summary, | ||
description: description, | ||
links: links, | ||
examples: examples | ||
} | ||
return { | ||
summary: summary, | ||
description: description, | ||
links: links, | ||
examples: examples | ||
} | ||
} | ||
export function Example(title, body) { | ||
return { | ||
title: title, | ||
body: body | ||
} | ||
return { | ||
title: title, | ||
body: body | ||
} | ||
} | ||
export function Return(type, doc, srcDoc) { | ||
return { | ||
type: type, | ||
doc: doc, | ||
srcDoc: srcDoc | ||
} | ||
return { | ||
type: type, | ||
doc: doc, | ||
srcDoc: srcDoc | ||
} | ||
} | ||
export function Operation(name, labels, nameParams, params, ret, locations, docs, srcDocs) { | ||
return { | ||
name: name, | ||
nameParams: nameParams, | ||
labels: labels, | ||
params: params, | ||
ret: ret, | ||
locations: locations, | ||
docs: docs, | ||
srcDocs: srcDocs | ||
} | ||
export function Operation(name, labels, nameParams, params, ret, locations, docs, srcDocs, extra) { | ||
return { | ||
name: name, | ||
nameParams: nameParams, | ||
labels: labels, | ||
params: params, | ||
ret: ret, | ||
locations: locations, | ||
docs: docs, | ||
srcDocs: srcDocs, | ||
extra: extra || {} | ||
} | ||
} | ||
export function Param(name, type, doc, srcDoc, optional, defaultValue, spread) { | ||
return { | ||
name: name, | ||
type: type, | ||
doc: doc, | ||
srcDoc: srcDoc, | ||
optional: optional, | ||
defaultValue: defaultValue, | ||
spread: spread | ||
} | ||
return { | ||
name: name, | ||
type: type, | ||
doc: doc, | ||
srcDoc: srcDoc, | ||
optional: optional, | ||
defaultValue: defaultValue, | ||
spread: spread | ||
} | ||
} | ||
export function Property(name, labels, isGet, isSet, type, locations, docs, srcDocs) { | ||
return { | ||
name: name, | ||
labels: labels, | ||
get: isGet, | ||
set: isSet, | ||
type: type, | ||
locations: locations, | ||
docs: docs, | ||
srcDocs: srcDocs | ||
} | ||
export function Property(name, labels, isGet, isSet, type, locations, docs, srcDocs, extra) { | ||
return { | ||
name: name, | ||
labels: labels, | ||
get: isGet, | ||
set: isSet, | ||
type: type, | ||
locations: locations, | ||
docs: docs, | ||
srcDocs: srcDocs, | ||
extra: extra || {} | ||
} | ||
} | ||
export function Message(name, labels, members, locations, docs, srcDocs) { | ||
return { | ||
name: name, | ||
labels: labels, | ||
members: members, | ||
locations: locations, | ||
docs: docs, | ||
srcDocs: srcDocs | ||
} | ||
export function Message(name, labels, members, locations, docs, srcDocs, extra) { | ||
return { | ||
name: name, | ||
labels: labels, | ||
members: members, | ||
locations: locations, | ||
docs: docs, | ||
srcDocs: srcDocs, | ||
extra: extra || {} | ||
} | ||
} | ||
export function MessageMember(name, type, docs, srcDocs) { | ||
return { | ||
name: name, | ||
type: type, | ||
docs: docs, | ||
srcDocs: srcDocs | ||
} | ||
return { | ||
name: name, | ||
type: type, | ||
docs: docs, | ||
srcDocs: srcDocs | ||
} | ||
} | ||
export function AtomicType(name) { | ||
return name; | ||
return name; | ||
} | ||
export function UnionType(names) { | ||
return names; | ||
return names; | ||
} | ||
export function GeneticType(name, typeParams) { | ||
return { | ||
name: name, | ||
typeParams: typeParams | ||
}; | ||
return { | ||
name: name, | ||
typeParams: typeParams | ||
}; | ||
} | ||
export function Location(filename, lineno) { | ||
return { | ||
filename: filename, | ||
lineno: lineno | ||
} | ||
return { | ||
filename: filename, | ||
lineno: lineno | ||
} | ||
} | ||
export function JsDocError(message, locations) { | ||
const groupByFile = (groups, location) => { | ||
if (groups[location.filename]) | ||
groups[location.filename].push(location); | ||
else | ||
groups[location.filename] = [location]; | ||
return groups; | ||
}; | ||
const groupByFile = (groups, location) => { | ||
if (groups[location.filename]) | ||
groups[location.filename].push(location); | ||
else | ||
groups[location.filename] = [location]; | ||
return groups; | ||
}; | ||
let files = locations.reduce(groupByFile, {}); | ||
let fileLocations = Object.keys(files) | ||
.map((group) => { | ||
let linenos = files[group].map(location => location.lineno); | ||
return `${group} (${linenos.join(", ")})`; | ||
}) | ||
.join(", "); | ||
return { | ||
message: message, | ||
location: fileLocations | ||
} | ||
let files = locations.reduce(groupByFile, {}); | ||
let fileLocations = Object.keys(files) | ||
.map((group) => { | ||
let linenos = files[group].map(location => location.lineno); | ||
return `${group} (${linenos.join(", ")})`; | ||
}) | ||
.join(", "); | ||
return { | ||
message: message, | ||
location: fileLocations | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7225
5
279
1