From 0d27e904c57122e439edf1414e9535521ed18e99 Mon Sep 17 00:00:00 2001 From: zhangxuemei Date: Sat, 24 Nov 2018 16:41:34 +0800 Subject: [PATCH] pass --- .gitignore | 4 +++- lib/blink.js | 5 ++++- lib/capture.js | 3 +++ lib/capture_breakword.js | 3 +++ lib/quantified_group.js | 2 ++ lib/quotes.js | 2 ++ 6 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index b512c09..420f7de 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -node_modules \ No newline at end of file +node_modules +yarn-error.log* +yarn.lock* \ No newline at end of file diff --git a/lib/blink.js b/lib/blink.js index c391a9f..07b6cc7 100644 --- a/lib/blink.js +++ b/lib/blink.js @@ -3,5 +3,8 @@ var marked = require('marked') module.exports = function (str) { var md = marked(str) // TODO - return null + const reg = /(\@\@)(.*?)(\@\@)/g + return md.replace(reg, (...args) => { + return `${args[2] || null}`; + }) } \ No newline at end of file diff --git a/lib/capture.js b/lib/capture.js index a08ee57..efa2d47 100644 --- a/lib/capture.js +++ b/lib/capture.js @@ -1,3 +1,6 @@ module.exports = function (str) { // TODO + const reg = /\=(\d+)/; + const result = str.match(reg); + return result && result[1]; } \ No newline at end of file diff --git a/lib/capture_breakword.js b/lib/capture_breakword.js index a08ee57..e6a2b33 100644 --- a/lib/capture_breakword.js +++ b/lib/capture_breakword.js @@ -1,3 +1,6 @@ module.exports = function (str) { // TODO + const reg = /(?:(?:\bx)|(?:\w+[^x]))\=(\d+)\b/; + const result = str.match(reg); + return result && result[1]; } \ No newline at end of file diff --git a/lib/quantified_group.js b/lib/quantified_group.js index a08ee57..575c6fd 100644 --- a/lib/quantified_group.js +++ b/lib/quantified_group.js @@ -1,3 +1,5 @@ module.exports = function (str) { // TODO + const reg = /^(0x[a-fA-F0-9]{2}\s*){8}$/; + return reg.test(str); } \ No newline at end of file diff --git a/lib/quotes.js b/lib/quotes.js index a08ee57..32d2ffe 100644 --- a/lib/quotes.js +++ b/lib/quotes.js @@ -1,3 +1,5 @@ module.exports = function (str) { // TODO + const reg = /\".*?\"/g; + return str.match(reg); } \ No newline at end of file