emanual-interview
Advanced tools
Comparing version 1.1.0 to 1.1.1
- type: reply | ||
- tag: android | ||
- difficulty: 1 | ||
- from: 网络整理 | ||
- FROM: http://google.com | ||
@@ -12,2 +12,4 @@ -------- | ||
挺好的🐔 | ||
@@ -7,8 +7,10 @@ 'use strict' | ||
*/ | ||
function parser_setting (lines) { | ||
function parser_setting(lines) { | ||
var setting = {} | ||
for (let i = 0;i < lines.length; i++) { | ||
for (let i = 0; i < lines.length; i++) { | ||
if (lines[i].startsWith('-')) { | ||
let tmp = lines[i].substring(lines[i].indexOf('-') + 1, lines[i].length) | ||
setting[tmp.split(':')[0].trim().toLowerCase()] = tmp.split(':')[1].trim().toLowerCase() | ||
let tmp = lines[i].substring(1, lines[i].length) | ||
let key = tmp.substring(0, tmp.indexOf(':')) | ||
let value = tmp.replace(tmp.substring(0, tmp.indexOf(':') + 1), '') | ||
setting[key.trim().toLowerCase()] = value.trim().toLowerCase() | ||
} | ||
@@ -22,4 +24,4 @@ } | ||
*/ | ||
function parser_descriptionBody (lines) { | ||
for (let index = 0;index < lines.length;index++) { | ||
function parser_descriptionBody(lines) { | ||
for (let index = 0; index < lines.length; index++) { | ||
if (lines[index].startsWith('A、')) { | ||
@@ -38,6 +40,6 @@ return { | ||
function parse_option (lines) { | ||
function parse_option(lines) { | ||
let options = [] | ||
let tmpOptionLines = [] | ||
for (let index = 0; index < lines.length;index++) { | ||
for (let index = 0; index < lines.length; index++) { | ||
if (/\w、/.test(lines[index])) { | ||
@@ -64,3 +66,3 @@ if ('' !== tmpOptionLines.join('\n').trim()) { | ||
*/ | ||
function parser_answer (lines) { | ||
function parser_answer(lines) { | ||
return lines.join('\n').trim() | ||
@@ -74,3 +76,3 @@ } | ||
*/ | ||
function subArray (arr, start, end) { | ||
function subArray(arr, start, end) { | ||
let res = [] | ||
@@ -87,3 +89,3 @@ for (let i = start; i <= end; i++) { | ||
*/ | ||
function parser (content) { | ||
function parser(content) { | ||
let lines = content.split('\n') | ||
@@ -102,3 +104,3 @@ let question = { | ||
// setting | ||
while(!lines[end].startsWith('---')){ | ||
while (!lines[end].startsWith('---')) { | ||
end++ | ||
@@ -111,9 +113,9 @@ } | ||
question.from = setting.from || '' | ||
end++, start = end | ||
end++ , start = end | ||
// description | ||
while(!lines[end].startsWith('---')){ | ||
while (!lines[end].startsWith('---')) { | ||
end++ | ||
} | ||
let descriptionBody = parser_descriptionBody(subArray(lines, start, end - 1)) | ||
let descriptionBody = parser_descriptionBody(subArray(lines, start, end - 1)) | ||
question.description = descriptionBody.description | ||
@@ -120,0 +122,0 @@ question.options = descriptionBody.options |
{ | ||
"name": "emanual-interview", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "EManual integer on node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
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
18608
162