aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/date-fns/locale/_lib/buildMatchPatternFn/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/date-fns/locale/_lib/buildMatchPatternFn/index.js')
-rw-r--r--node_modules/date-fns/locale/_lib/buildMatchPatternFn/index.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/node_modules/date-fns/locale/_lib/buildMatchPatternFn/index.js b/node_modules/date-fns/locale/_lib/buildMatchPatternFn/index.js
new file mode 100644
index 0000000..2b254fa
--- /dev/null
+++ b/node_modules/date-fns/locale/_lib/buildMatchPatternFn/index.js
@@ -0,0 +1,24 @@
+"use strict";
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = buildMatchPatternFn;
+function buildMatchPatternFn(args) {
+ return function (string) {
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
+ var matchResult = string.match(args.matchPattern);
+ if (!matchResult) return null;
+ var matchedString = matchResult[0];
+ var parseResult = string.match(args.parsePattern);
+ if (!parseResult) return null;
+ var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
+ value = options.valueCallback ? options.valueCallback(value) : value;
+ var rest = string.slice(matchedString.length);
+ return {
+ value: value,
+ rest: rest
+ };
+ };
+}
+module.exports = exports.default; \ No newline at end of file
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage