From 4b7b24d543fcb79700db09503989d8b9434300cd Mon Sep 17 00:00:00 2001 From: Macide Celik Date: Tue, 29 Oct 2019 11:14:47 +0300 Subject: [PATCH] Delete ExtractDates.mjs --- src/core/operations/ExtractDates.mjs | 52 ---------------------------- 1 file changed, 52 deletions(-) delete mode 100644 src/core/operations/ExtractDates.mjs diff --git a/src/core/operations/ExtractDates.mjs b/src/core/operations/ExtractDates.mjs deleted file mode 100644 index dfe93c88..00000000 --- a/src/core/operations/ExtractDates.mjs +++ /dev/null @@ -1,52 +0,0 @@ -/** - * @author n1474335 [n1474335@gmail.com] - * @copyright Crown Copyright 2016 - * @license Apache-2.0 - */ - -import Operation from "../Operation.mjs"; -import { search } from "../lib/Extract.mjs"; - -/** - * Extract dates operation - */ -class ExtractDates extends Operation { - - /** - * ExtractDates constructor - */ - constructor() { - super(); - - this.name = "Extract dates"; - this.module = "Regex"; - this.description = "Extracts dates in the following formatsDividers can be any of /, -, . or space"; - this.inputType = "string"; - this.outputType = "string"; - this.args = [ - { - "name": "Display total", - "type": "boolean", - "value": false - } - ]; - } - - /** - * @param {string} input - * @param {Object[]} args - * @returns {string} - */ - run(input, args) { - const displayTotal = args[0], - date1 = "(?:19|20)\\d\\d[- /.](?:0[1-9]|1[012])[- /.](?:0[1-9]|[12][0-9]|3[01])", // yyyy-mm-dd - date2 = "(?:0[1-9]|[12][0-9]|3[01])[- /.](?:0[1-9]|1[012])[- /.](?:19|20)\\d\\d", // dd/mm/yyyy - date3 = "(?:0[1-9]|1[012])[- /.](?:0[1-9]|[12][0-9]|3[01])[- /.](?:19|20)\\d\\d", // mm/dd/yyyy - regex = new RegExp(date1 + "|" + date2 + "|" + date3, "ig"); - - return search(input, regex, null, displayTotal); - } - -} - -export default ExtractDates;