Comparing version 0.1.5 to 0.1.6
@@ -13,6 +13,6 @@ declare module "academia" { | ||
/** | ||
Given a list of strings representing individual references in a bibliography, | ||
parse each one into a Reference structure. | ||
Given a string representing an individual reference in a bibliography, parse | ||
it into a Reference structure. | ||
*/ | ||
function parseReferences(references: string[]): types.Reference[]; | ||
function parseReference(reference: string): types.Reference; | ||
/** | ||
@@ -147,4 +147,5 @@ In-place modifies `cites` by setting the `reference` value of each one where | ||
references?: Reference[]; | ||
cites?: Cite[]; | ||
} | ||
} | ||
} |
24
index.js
@@ -56,17 +56,15 @@ /// <reference path="./type_declarations/index.d.ts" /> | ||
/** | ||
Given a list of strings representing individual references in a bibliography, | ||
parse each one into a Reference structure. | ||
Given a string representing an individual reference in a bibliography, parse | ||
it into a Reference structure. | ||
*/ | ||
function parseReferences(references) { | ||
return references.map(function (reference) { | ||
var match = reference.match(acl.referenceRegExp); | ||
var authors = match ? names.parseNames(match[1]) : []; | ||
return { | ||
authors: authors, | ||
year: match ? match[2] : undefined, | ||
title: match ? match[3] : undefined, | ||
}; | ||
}); | ||
function parseReference(reference) { | ||
var match = reference.match(acl.referenceRegExp); | ||
var authors = match ? names.parseNames(match[1]) : []; | ||
return { | ||
authors: authors, | ||
year: match ? match[2] : undefined, | ||
title: match ? match[3] : undefined, | ||
}; | ||
} | ||
acl.parseReferences = parseReferences; | ||
acl.parseReference = parseReference; | ||
/** | ||
@@ -73,0 +71,0 @@ In-place modifies `cites` by setting the `reference` value of each one where |
@@ -11,3 +11,3 @@ { | ||
], | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"homepage": "https://github.com/chbrown/academia", | ||
@@ -14,0 +14,0 @@ "repository": "git://github.com/chbrown/academia.git", |
@@ -62,2 +62,3 @@ # academia | ||
references?: Reference[], | ||
cites?: Cite[], | ||
} | ||
@@ -64,0 +65,0 @@ |
@@ -50,17 +50,15 @@ var types = require('../types'); | ||
/** | ||
Given a list of strings representing individual references in a bibliography, | ||
parse each one into a Reference structure. | ||
Given a string representing an individual reference in a bibliography, parse | ||
it into a Reference structure. | ||
*/ | ||
function parseReferences(references) { | ||
return references.map(function (reference) { | ||
var match = reference.match(exports.referenceRegExp); | ||
var authors = match ? names.parseNames(match[1]) : []; | ||
return { | ||
authors: authors, | ||
year: match ? match[2] : undefined, | ||
title: match ? match[3] : undefined, | ||
}; | ||
}); | ||
function parseReference(reference) { | ||
var match = reference.match(exports.referenceRegExp); | ||
var authors = match ? names.parseNames(match[1]) : []; | ||
return { | ||
authors: authors, | ||
year: match ? match[2] : undefined, | ||
title: match ? match[3] : undefined, | ||
}; | ||
} | ||
exports.parseReferences = parseReferences; | ||
exports.parseReference = parseReference; | ||
/** | ||
@@ -67,0 +65,0 @@ In-place modifies `cites` by setting the `reference` value of each one where |
@@ -55,15 +55,13 @@ import types = require('../types'); | ||
/** | ||
Given a list of strings representing individual references in a bibliography, | ||
parse each one into a Reference structure. | ||
Given a string representing an individual reference in a bibliography, parse | ||
it into a Reference structure. | ||
*/ | ||
export function parseReferences(references: string[]): types.Reference[] { | ||
return references.map(reference => { | ||
var match = reference.match(referenceRegExp); | ||
var authors = match ? names.parseNames(match[1]) : []; | ||
return { | ||
authors: authors, | ||
year: match ? match[2] : undefined, | ||
title: match ? match[3] : undefined, | ||
}; | ||
}); | ||
export function parseReference(reference: string): types.Reference { | ||
var match = reference.match(referenceRegExp); | ||
var authors = match ? names.parseNames(match[1]) : []; | ||
return { | ||
authors: authors, | ||
year: match ? match[2] : undefined, | ||
title: match ? match[3] : undefined, | ||
}; | ||
} | ||
@@ -70,0 +68,0 @@ |
@@ -75,2 +75,3 @@ /** | ||
references?: Reference[]; | ||
cites?: Cite[]; | ||
} |
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
130219
23
2884
76
2