@citation-js/plugin-ris
Advanced tools
Comparing version 0.4.9 to 0.5.0-alpha.0
@@ -1,9 +0,1 @@ | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
import { parse as parseDate } from '@citation-js/date'; | ||
@@ -68,8 +60,4 @@ import TYPES from './spec/types'; | ||
const parts = name.split(/, ?/); | ||
const [family, given, suffix] = parts; | ||
const _parts = _slicedToArray(parts, 3), | ||
family = _parts[0], | ||
given = _parts[1], | ||
suffix = _parts[2]; | ||
switch (parts.length) { | ||
@@ -76,0 +64,0 @@ case 3: |
@@ -1,9 +0,1 @@ | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
import { util } from '@citation-js/core'; | ||
@@ -20,51 +12,31 @@ import config from './config'; | ||
if (!TRANSLATORS.has(spec)) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (let mapping of spec) { | ||
if (mapping.target in DATA_TYPES) { | ||
mapping.convert = CONVERTERS[DATA_TYPES[mapping.target]]; | ||
} | ||
try { | ||
for (var _iterator = spec[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
let mapping = _step.value; | ||
if (mapping.convert && mapping.convert.keepAll === true) { | ||
continue; | ||
} | ||
if (mapping.target in DATA_TYPES) { | ||
mapping.convert = CONVERTERS[DATA_TYPES[mapping.target]]; | ||
} | ||
if (Array.isArray(mapping.source)) { | ||
if (mapping.convert) { | ||
const { | ||
toSource, | ||
toTarget | ||
} = mapping.convert; | ||
mapping.convert = { | ||
toTarget(...args) { | ||
return toTarget(CONVERTERS.ANY.toTarget(...args)); | ||
}, | ||
if (mapping.convert && mapping.convert.keepAll === true) { | ||
continue; | ||
} | ||
toSource(...args) { | ||
return CONVERTERS.ANY.toSource(toSource(...args)); | ||
} | ||
if (Array.isArray(mapping.source)) { | ||
if (mapping.convert) { | ||
const _mapping$convert = mapping.convert, | ||
toSource = _mapping$convert.toSource, | ||
toTarget = _mapping$convert.toTarget; | ||
mapping.convert = { | ||
toTarget(...args) { | ||
return toTarget(CONVERTERS.ANY.toTarget(...args)); | ||
}, | ||
toSource(...args) { | ||
return CONVERTERS.ANY.toSource(toSource(...args)); | ||
} | ||
}; | ||
} else { | ||
mapping.convert = CONVERTERS.ANY; | ||
} | ||
}; | ||
} else { | ||
mapping.convert = CONVERTERS.ANY; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return != null) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
@@ -82,52 +54,29 @@ | ||
let lastTag; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
try { | ||
for (var _iterator2 = text.split('\n')[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
let line = _step2.value; | ||
for (let line of text.split('\n')) { | ||
if (!LINE_MATCH.test(line)) { | ||
lastEntry[lastTag] += line; | ||
} | ||
if (!LINE_MATCH.test(line)) { | ||
lastEntry[lastTag] += line; | ||
} | ||
const [tag, value] = line.split(LINE_SPLIT); | ||
const _line$split = line.split(LINE_SPLIT), | ||
_line$split2 = _slicedToArray(_line$split, 2), | ||
tag = _line$split2[0], | ||
value = _line$split2[1]; | ||
switch (tag) { | ||
case 'ER': | ||
lastEntry = undefined; | ||
lastTag = undefined; | ||
break; | ||
switch (tag) { | ||
case 'ER': | ||
lastEntry = undefined; | ||
lastTag = undefined; | ||
break; | ||
case 'TY': | ||
lastEntry = {}; | ||
entries.push(lastEntry); | ||
case 'TY': | ||
lastEntry = {}; | ||
entries.push(lastEntry); | ||
default: | ||
if (Array.isArray(lastEntry[tag])) { | ||
lastEntry[tag].push(value); | ||
} else { | ||
lastEntry[tag] = lastEntry[tag] ? [lastEntry[tag], value] : value; | ||
} | ||
default: | ||
if (Array.isArray(lastEntry[tag])) { | ||
lastEntry[tag].push(value); | ||
} else { | ||
lastEntry[tag] = lastEntry[tag] ? [lastEntry[tag], value] : value; | ||
} | ||
lastTag = tag; | ||
} | ||
lastTag = tag; | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return != null) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
@@ -134,0 +83,0 @@ |
@@ -14,10 +14,2 @@ "use strict"; | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
const ISSN_REGEX = /^\d{4}-\d{4}$/; | ||
@@ -80,8 +72,4 @@ const CONVERTERS = { | ||
const parts = name.split(/, ?/); | ||
const [family, given, suffix] = parts; | ||
const _parts = _slicedToArray(parts, 3), | ||
family = _parts[0], | ||
given = _parts[1], | ||
suffix = _parts[2]; | ||
switch (parts.length) { | ||
@@ -88,0 +76,0 @@ case 3: |
137
lib/ris.js
@@ -24,10 +24,2 @@ "use strict"; | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } | ||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } | ||
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } | ||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } | ||
const LINE_MATCH = /^[A-Z][A-Z0-9] {2}-( |$)/; | ||
@@ -39,51 +31,31 @@ const LINE_SPLIT = / {2}-(?: |$)/; | ||
if (!TRANSLATORS.has(spec)) { | ||
var _iteratorNormalCompletion = true; | ||
var _didIteratorError = false; | ||
var _iteratorError = undefined; | ||
for (let mapping of spec) { | ||
if (mapping.target in _dataTypes.default) { | ||
mapping.convert = _converters.default[_dataTypes.default[mapping.target]]; | ||
} | ||
try { | ||
for (var _iterator = spec[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
let mapping = _step.value; | ||
if (mapping.convert && mapping.convert.keepAll === true) { | ||
continue; | ||
} | ||
if (mapping.target in _dataTypes.default) { | ||
mapping.convert = _converters.default[_dataTypes.default[mapping.target]]; | ||
} | ||
if (Array.isArray(mapping.source)) { | ||
if (mapping.convert) { | ||
const { | ||
toSource, | ||
toTarget | ||
} = mapping.convert; | ||
mapping.convert = { | ||
toTarget(...args) { | ||
return toTarget(_converters.default.ANY.toTarget(...args)); | ||
}, | ||
if (mapping.convert && mapping.convert.keepAll === true) { | ||
continue; | ||
} | ||
toSource(...args) { | ||
return _converters.default.ANY.toSource(toSource(...args)); | ||
} | ||
if (Array.isArray(mapping.source)) { | ||
if (mapping.convert) { | ||
const _mapping$convert = mapping.convert, | ||
toSource = _mapping$convert.toSource, | ||
toTarget = _mapping$convert.toTarget; | ||
mapping.convert = { | ||
toTarget(...args) { | ||
return toTarget(_converters.default.ANY.toTarget(...args)); | ||
}, | ||
toSource(...args) { | ||
return _converters.default.ANY.toSource(toSource(...args)); | ||
} | ||
}; | ||
} else { | ||
mapping.convert = _converters.default.ANY; | ||
} | ||
}; | ||
} else { | ||
mapping.convert = _converters.default.ANY; | ||
} | ||
} | ||
} catch (err) { | ||
_didIteratorError = true; | ||
_iteratorError = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion && _iterator.return != null) { | ||
_iterator.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError) { | ||
throw _iteratorError; | ||
} | ||
} | ||
} | ||
@@ -101,52 +73,29 @@ | ||
let lastTag; | ||
var _iteratorNormalCompletion2 = true; | ||
var _didIteratorError2 = false; | ||
var _iteratorError2 = undefined; | ||
try { | ||
for (var _iterator2 = text.split('\n')[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
let line = _step2.value; | ||
for (let line of text.split('\n')) { | ||
if (!LINE_MATCH.test(line)) { | ||
lastEntry[lastTag] += line; | ||
} | ||
if (!LINE_MATCH.test(line)) { | ||
lastEntry[lastTag] += line; | ||
} | ||
const [tag, value] = line.split(LINE_SPLIT); | ||
const _line$split = line.split(LINE_SPLIT), | ||
_line$split2 = _slicedToArray(_line$split, 2), | ||
tag = _line$split2[0], | ||
value = _line$split2[1]; | ||
switch (tag) { | ||
case 'ER': | ||
lastEntry = undefined; | ||
lastTag = undefined; | ||
break; | ||
switch (tag) { | ||
case 'ER': | ||
lastEntry = undefined; | ||
lastTag = undefined; | ||
break; | ||
case 'TY': | ||
lastEntry = {}; | ||
entries.push(lastEntry); | ||
case 'TY': | ||
lastEntry = {}; | ||
entries.push(lastEntry); | ||
default: | ||
if (Array.isArray(lastEntry[tag])) { | ||
lastEntry[tag].push(value); | ||
} else { | ||
lastEntry[tag] = lastEntry[tag] ? [lastEntry[tag], value] : value; | ||
} | ||
default: | ||
if (Array.isArray(lastEntry[tag])) { | ||
lastEntry[tag].push(value); | ||
} else { | ||
lastEntry[tag] = lastEntry[tag] ? [lastEntry[tag], value] : value; | ||
} | ||
lastTag = tag; | ||
} | ||
lastTag = tag; | ||
} | ||
} catch (err) { | ||
_didIteratorError2 = true; | ||
_iteratorError2 = err; | ||
} finally { | ||
try { | ||
if (!_iteratorNormalCompletion2 && _iterator2.return != null) { | ||
_iterator2.return(); | ||
} | ||
} finally { | ||
if (_didIteratorError2) { | ||
throw _iteratorError2; | ||
} | ||
} | ||
} | ||
@@ -153,0 +102,0 @@ |
@@ -8,3 +8,3 @@ "use strict"; | ||
enumerable: true, | ||
get: function get() { | ||
get: function () { | ||
return _types.default; | ||
@@ -11,0 +11,0 @@ } |
{ | ||
"name": "@citation-js/plugin-ris", | ||
"version": "0.4.9", | ||
"version": "0.5.0-alpha.0", | ||
"description": "Plugin for RIS formats for Citation.js", | ||
@@ -23,3 +23,3 @@ "keywords": [ | ||
"engines": { | ||
"node": ">=6.0.0" | ||
"node": ">=8" | ||
}, | ||
@@ -38,3 +38,3 @@ "files": [ | ||
"devDependencies": { | ||
"@citation-js/core": "^0.4.9" | ||
"@citation-js/core": "^0.5.0-alpha.0" | ||
}, | ||
@@ -44,3 +44,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "5e9b903060186dbd3df668e40da6cad1599c15c0" | ||
"gitHead": "68a69847510cc948b1dae7f7d81c8fa1430a183b" | ||
} |
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
0
200106
11017