From b4f2f9d4c44cffc7086876d3806291a771cc9f6c Mon Sep 17 00:00:00 2001 From: "Andrey C. Miranda" Date: Fri, 18 May 2018 23:19:05 -0300 Subject: [PATCH] refactor: remove modifier --- README.md | 1 - index.js | 6 +++--- index.min.js | 6 +++--- index.min.js.map | 2 +- index.next.js | 1 - 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 7426b50..38e5ee4 100644 --- a/README.md +++ b/README.md @@ -113,7 +113,6 @@ startGroup: '(' endGroup: ')' startCharset: '[' endCharset: ']' -modifier(input) quote(value) value(value) plus(value) diff --git a/index.js b/index.js index 680f5a5..8c051d0 100644 --- a/index.js +++ b/index.js @@ -8,8 +8,8 @@ * * ~~~~~~~~~~ rx4d v1.3.0 * - * @commit f1195d99aacad1e1c3c4353332c84910bb3e0625 - * @moment Friday, May 18, 2018 10:56 PM + * @commit 9666d051dc8d838308b83018598ef21ddb2b4076 + * @moment Friday, May 18, 2018 11:14 PM * @homepage https://github.com/adriancmiranda/rx4d#readme * @author Adrian C. Miranda * @license (c) 2016-2021 Adrian C. Miranda @@ -230,7 +230,6 @@ endGroup: ')', startCharset: '[', endCharset: ']', - modifier: function (self, last, input) { return (self + '(?' + input + ')'); }, quote: function (self, last, input) { return ('' + self + (val(input))); }, value: function (self, last, input) { return ('' + self + (src(input))); }, plus: function (self, last, input) { return ('' + self + (src(input))); }, @@ -277,4 +276,5 @@ exports.val = val; Object.defineProperty(exports, '__esModule', { value: true }); + }))); diff --git a/index.min.js b/index.min.js index 5bdc4d0..3c52a11 100644 --- a/index.min.js +++ b/index.min.js @@ -8,11 +8,11 @@ * * ~~~~~~~~~~ rx4d v1.3.0 * - * @commit f1195d99aacad1e1c3c4353332c84910bb3e0625 - * @moment Friday, May 18, 2018 10:56 PM + * @commit 9666d051dc8d838308b83018598ef21ddb2b4076 + * @moment Friday, May 18, 2018 11:14 PM * @homepage https://github.com/adriancmiranda/rx4d#readme * @author Adrian C. Miranda * @license (c) 2016-2021 Adrian C. Miranda */ -!(function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(n.rx4d={})})(this,(function(n){"use strict";function e(n){return"string"==typeof n||n instanceof String}function t(n){return"function"==typeof n}function r(n){return (function(n){return null!=n&&n.constructor===Array})(n)||e(n)||!!n&&"object"==typeof n&&"number"==typeof n.length&&(0===n.length||n.length>0&&n.length-1 in n)}function u(n,e,t,u){try{var c=r(t)?t:[];switch(c.length){case 0:return n.call(e);case 1:return n.call(e,c[0]);case 2:return n.call(e,c[0],c[1]);case 3:return n.call(e,c[0],c[1],c[2]);case 4:return n.call(e,c[0],c[1],c[2],c[3]);case 5:return n.call(e,c[0],c[1],c[2],c[3],c[4]);case 6:return n.call(e,c[0],c[1],c[2],c[3],c[4],c[5]);case 7:return n.call(e,c[0],c[1],c[2],c[3],c[4],c[5],c[6]);case 8:return n.call(e,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7]);case 9:return n.call(e,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8]);default:return n.apply(e,c)}}catch(n){if(u)return n;throw n}}var c=Object.setPrototypeOf,o=Object.defineProperties,i=Object.create,a=Object.keys,f=Array.from,l=function(n,e){return f(n).reduce((function(n,e){return n[n.length]=t(e)?e():e,n}),e)},s=function(n,e){function r(){var r=this,c="",o=this.object.reduce((function(e,o){if(t(n[o.name])){var i=l(o.args,[e,c]);e=u(n[o.name],r,i),c=e}else e+=n[o.name],c=n[o.name];return e}),c);return e?u(e,this,[o,arguments],!0):o}function f(n){function e(){return u(r,e,arguments)}return e.object=n,c(e,p),e}var s=a(n).reduce((function(e,r){var u,c=t(n[r]);return e[r]=((u={})[c?"value":"get"]=function(){return f(this.object.concat({name:r,args:arguments}))},u),e}),i(null)),p=o((function(){}),s);return o({object:n},a(s).reduce((function(e,r){var u,c=t(n[r]);return e[r]=((u={})[c?"value":"get"]=function(){return f([{name:r,args:arguments}])},u),e}),i(null)))},p=/[-[/\]{}()*+?.,\\^$|#\s]/g,h=function(n){return void 0===n?"undefined":null===n?"null":n.source?h(n.source):n},d=function(n){return n=h(n),"number"==typeof(t=n)||t instanceof Number?n:(function(n){return n=e(n)?n:"",p.lastIndex=0,n.replace(p,"\\$&")})(n);var t},g={beginningOfInput:"^",endOfInput:"$",anySingleCharExceptTheNewline:".",anySingleChar:"[\\s\\S]",somethingExceptTheNewline:"(?:.+)",something:"(?:[\\s\\S]+)",anythingExceptTheNewline:"(?:.*)",anything:"(?:[\\s\\S]*)",zeroOrMoreTimes:"*",oneOrMoreTimes:"+",zeroOrOneTime:"?",or:"|",escape:"\\",backslash:"\\",backspace:"[\\b]",wordBoundary:"\\b",nonWordBoundary:"\\B",digit:"\\d",nonDigit:"\\D",formFeed:"\\f",lineFeed:"\\n",lineBreak:"\\r\\n?|\\n|\\u2028|\\u2029",carriageReturn:"\\r",whiteSpace:"\\s",notWhiteSpace:"\\S",nonASCIIWhiteSpace:"[\\u1680\\u180e\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff]",tab:"\\t",verticalTab:"\\v",alphanumeric:"\\w",alphanumerical:"\\w",nonWord:"\\W",nul:"\\0",nil:"\\0",lowercase:"[a-z]",uppercase:"[A-Z]",letter:"[a-zA-Z]",numeric:"[0-9]",varchar:"[a-zA-Z_$][0-9a-zA-Z_$]",eol:"(?:(?:\\n)|(?:\\r\\n))",startCapture:"(",endCapture:")",startGroup:"(",endGroup:")",startCharset:"[",endCharset:"]",modifier:function(n,e,t){return n+"(?"+t+")"},quote:function(n,e,t){return""+n+d(t)},value:function(n,e,t){return""+n+h(t)},plus:function(n,e,t){return""+n+h(t)},unicode:function(n,e,t){return n+"\\u"+t},control:function(n,e,t){return n+"\\c"+t},notRemember:function(n,e,t){return n+"(?:"+h(t)+")"},then:function(n,e,t){return n+"(?:"+h(t)+")"},find:function(n,e,t){return n+"(?:"+h(t)+")"},maybe:function(n,e,t){return n+"(?:"+h(t)+")*"},maybeOne:function(n,e,t){return n+"(?:"+h(t)+")?"},ifFollowedBy:function(n,e,t){return n+"(?="+h(t)+")"},ifNotFollowedBy:function(n,e,t){return n+"(?!"+h(t)+")"},anythingBut:function(n,e,t){return n+"(?:[^"+h(t)+"]*)"},somethingBut:function(n,e,t){return n+"(?:[^"+h(t)+"]+)"},notCharset:function(n,e,t){return n+"[^"+h(t)+"]"},charset:function(n,e,t){return n+"["+h(t)+"]"},any:function(n,e,t){return n+"["+h(t)+"]"},anyOf:function(n,e,t){return n+"["+h(t)+"]"},group:function(n,e,t){return n+"("+h(t)+")"},size:function(n,e,t){return n+"{"+(0|t)+"}"},atLeast:function(n,e,t){return n+"{"+(0|t)+",}"},atMost:function(n,e,t){return n+"{,"+(0|t)+"}"},range:function(n,e,t,r){return n+"{"+(0|t)+","+(0|r)+"}"},repeat:function(n,e,t){return""+n+new Array(1+(0|t)).join(e)},replace:function(n,e,t,r){return n.replace(t,r)},flags:function(n,e,t){return new RegExp(n,t)},either:function(n,e){for(var t=[],r=arguments.length-2;r-- >0;)t[r]=arguments[r+2];return""+n+t.join("|")}},y=Object.assign,m=s(g);n.rules=function(n,e,t){return void 0===n||null===n?m:s(y({},n,g,e),t)},n.match=m,n.src=h,n.val=d,Object.defineProperty(n,"__esModule",{value:!0})})); +!(function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(n.rx4d={})})(this,(function(n){"use strict";function e(n){return"string"==typeof n||n instanceof String}function t(n){return"function"==typeof n}function r(n){return (function(n){return null!=n&&n.constructor===Array})(n)||e(n)||!!n&&"object"==typeof n&&"number"==typeof n.length&&(0===n.length||n.length>0&&n.length-1 in n)}function u(n,e,t,u){try{var c=r(t)?t:[];switch(c.length){case 0:return n.call(e);case 1:return n.call(e,c[0]);case 2:return n.call(e,c[0],c[1]);case 3:return n.call(e,c[0],c[1],c[2]);case 4:return n.call(e,c[0],c[1],c[2],c[3]);case 5:return n.call(e,c[0],c[1],c[2],c[3],c[4]);case 6:return n.call(e,c[0],c[1],c[2],c[3],c[4],c[5]);case 7:return n.call(e,c[0],c[1],c[2],c[3],c[4],c[5],c[6]);case 8:return n.call(e,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7]);case 9:return n.call(e,c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8]);default:return n.apply(e,c)}}catch(n){if(u)return n;throw n}}var c=Object.setPrototypeOf,o=Object.defineProperties,a=Object.create,i=Object.keys,f=Array.from,l=function(n,e){return f(n).reduce((function(n,e){return n[n.length]=t(e)?e():e,n}),e)},s=function(n,e){function r(){var r=this,c="",o=this.object.reduce((function(e,o){if(t(n[o.name])){var a=l(o.args,[e,c]);e=u(n[o.name],r,a),c=e}else e+=n[o.name],c=n[o.name];return e}),c);return e?u(e,this,[o,arguments],!0):o}function f(n){function e(){return u(r,e,arguments)}return e.object=n,c(e,p),e}var s=i(n).reduce((function(e,r){var u,c=t(n[r]);return e[r]=((u={})[c?"value":"get"]=function(){return f(this.object.concat({name:r,args:arguments}))},u),e}),a(null)),p=o((function(){}),s);return o({object:n},i(s).reduce((function(e,r){var u,c=t(n[r]);return e[r]=((u={})[c?"value":"get"]=function(){return f([{name:r,args:arguments}])},u),e}),a(null)))},p=/[-[/\]{}()*+?.,\\^$|#\s]/g,h=function(n){return void 0===n?"undefined":null===n?"null":n.source?h(n.source):n},d=function(n){return n=h(n),"number"==typeof(t=n)||t instanceof Number?n:(function(n){return n=e(n)?n:"",p.lastIndex=0,n.replace(p,"\\$&")})(n);var t},g={beginningOfInput:"^",endOfInput:"$",anySingleCharExceptTheNewline:".",anySingleChar:"[\\s\\S]",somethingExceptTheNewline:"(?:.+)",something:"(?:[\\s\\S]+)",anythingExceptTheNewline:"(?:.*)",anything:"(?:[\\s\\S]*)",zeroOrMoreTimes:"*",oneOrMoreTimes:"+",zeroOrOneTime:"?",or:"|",escape:"\\",backslash:"\\",backspace:"[\\b]",wordBoundary:"\\b",nonWordBoundary:"\\B",digit:"\\d",nonDigit:"\\D",formFeed:"\\f",lineFeed:"\\n",lineBreak:"\\r\\n?|\\n|\\u2028|\\u2029",carriageReturn:"\\r",whiteSpace:"\\s",notWhiteSpace:"\\S",nonASCIIWhiteSpace:"[\\u1680\\u180e\\u2000-\\u200a\\u202f\\u205f\\u3000\\ufeff]",tab:"\\t",verticalTab:"\\v",alphanumeric:"\\w",alphanumerical:"\\w",nonWord:"\\W",nul:"\\0",nil:"\\0",lowercase:"[a-z]",uppercase:"[A-Z]",letter:"[a-zA-Z]",numeric:"[0-9]",varchar:"[a-zA-Z_$][0-9a-zA-Z_$]",eol:"(?:(?:\\n)|(?:\\r\\n))",startCapture:"(",endCapture:")",startGroup:"(",endGroup:")",startCharset:"[",endCharset:"]",quote:function(n,e,t){return""+n+d(t)},value:function(n,e,t){return""+n+h(t)},plus:function(n,e,t){return""+n+h(t)},unicode:function(n,e,t){return n+"\\u"+t},control:function(n,e,t){return n+"\\c"+t},notRemember:function(n,e,t){return n+"(?:"+h(t)+")"},then:function(n,e,t){return n+"(?:"+h(t)+")"},find:function(n,e,t){return n+"(?:"+h(t)+")"},maybe:function(n,e,t){return n+"(?:"+h(t)+")*"},maybeOne:function(n,e,t){return n+"(?:"+h(t)+")?"},ifFollowedBy:function(n,e,t){return n+"(?="+h(t)+")"},ifNotFollowedBy:function(n,e,t){return n+"(?!"+h(t)+")"},anythingBut:function(n,e,t){return n+"(?:[^"+h(t)+"]*)"},somethingBut:function(n,e,t){return n+"(?:[^"+h(t)+"]+)"},notCharset:function(n,e,t){return n+"[^"+h(t)+"]"},charset:function(n,e,t){return n+"["+h(t)+"]"},any:function(n,e,t){return n+"["+h(t)+"]"},anyOf:function(n,e,t){return n+"["+h(t)+"]"},group:function(n,e,t){return n+"("+h(t)+")"},size:function(n,e,t){return n+"{"+(0|t)+"}"},atLeast:function(n,e,t){return n+"{"+(0|t)+",}"},atMost:function(n,e,t){return n+"{,"+(0|t)+"}"},range:function(n,e,t,r){return n+"{"+(0|t)+","+(0|r)+"}"},repeat:function(n,e,t){return""+n+new Array(1+(0|t)).join(e)},replace:function(n,e,t,r){return n.replace(t,r)},flags:function(n,e,t){return new RegExp(n,t)},either:function(n,e){for(var t=[],r=arguments.length-2;r-- >0;)t[r]=arguments[r+2];return""+n+t.join("|")}},y=Object.assign,m=s(g);n.rules=function(n,e,t){return void 0===n||null===n?m:s(y({},n,g,e),t)},n.match=m,n.src=h,n.val=d,Object.defineProperty(n,"__esModule",{value:!0})})); //# sourceMappingURL=index.min.js.map diff --git a/index.min.js.map b/index.min.js.map index 6d34645..75e21ae 100644 --- a/index.min.js.map +++ b/index.min.js.map @@ -1 +1 @@ -{"version":3,"file":"index.min.js","sources":["node_modules/describe-type/source/is/array.js","node_modules/describe-type/source/is/arraylike.js","node_modules/object-chain/index.next.js","index.next.js"],"sourcesContent":["/**\n *\n * @function\n * @memberof is\n * @param {any} value\n * @returns {Boolean}\n */\nexport default function array(value) {\n\tif (value == null) return false;\n\treturn value.constructor === Array;\n}\n","import array from './array.js';\nimport string from './string.js';\n\n/**\n *\n * @function\n * @memberof is\n * @param {any} value\n * @returns {Boolean}\n */\nexport default function arraylike(value) {\n\treturn array(value) || string(value) || (\n\t\t(!!value && typeof value === 'object' && typeof value.length === 'number') &&\n\t\t(value.length === 0 || (value.length > 0 && (value.length - 1) in value))\n\t);\n}\n","import callable from 'describe-type/source/is/callable.js';\nimport apply from 'describe-type/source/@/apply.js';\n\nconst { setPrototypeOf, defineProperties, create, keys } = Object;\nconst arrayFrom = Array.from;\n\nconst processArgs = (args, initialValue) => (\n\tarrayFrom(args).reduce((acc, arg) => {\n\t\tacc[acc.length] = callable(arg) ? arg() : arg;\n\t\treturn acc;\n\t}, initialValue)\n);\n\nconst transform = (object, middleware) => {\n\tfunction chain() {\n\t\tlet last = '';\n\t\tconst pattern = this.object.reduce((acc, item) => {\n\t\t\tif (callable(object[item.name])) {\n\t\t\t\tconst args = processArgs(item.args, [acc, last]);\n\t\t\t\tacc = apply(object[item.name], this, args);\n\t\t\t\tlast = acc;\n\t\t\t} else {\n\t\t\t\tacc += object[item.name];\n\t\t\t\tlast = object[item.name];\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, last);\n\t\treturn middleware ? apply(middleware, this, [pattern, arguments], true) : pattern;\n\t}\n\n\tfunction connect(data) {\n\t\tfunction link() { return apply(chain, link, arguments); }\n\t\tlink.object = data;\n\t\tsetPrototypeOf(link, proto);\n\t\treturn link;\n\t}\n\n\tconst descriptors = keys(object).reduce((acc, name) => {\n\t\tconst isfn = callable(object[name]);\n\t\tacc[name] = {\n\t\t\t[isfn ? 'value' : 'get']: function connector() {\n\t\t\t\treturn connect(this.object.concat({ name, args: arguments }));\n\t\t\t},\n\t\t};\n\t\treturn acc;\n\t}, create(null));\n\n\tconst proto = defineProperties(function ObjectChain() {}, descriptors);\n\treturn defineProperties({ object }, keys(descriptors).reduce((acc, name) => {\n\t\tconst isfn = callable(object[name]);\n\t\tacc[name] = {\n\t\t\t[isfn ? 'value' : 'get']: function startup() {\n\t\t\t\treturn connect([{ name, args: arguments }]);\n\t\t\t},\n\t\t};\n\t\treturn acc;\n\t}, create(null)));\n};\n\nexport default transform;\n","import number from 'describe-type/source/is/number';\nimport string from 'describe-type/source/is/string';\nimport objectChain from 'object-chain';\n\nconst reEscapeRegExp = /[-[/\\]{}()*+?.,\\\\^$|#\\s]/g;\n\nconst escapeRegExp = (input) => {\n\tinput = string(input) ? input : '';\n\treEscapeRegExp.lastIndex = 0;\n\treturn input.replace(reEscapeRegExp, '\\\\$&');\n};\n\nconst src = (input) => {\n\tif (input === undefined) return 'undefined';\n\tif (input === null) return 'null';\n\tif (input.source) return src(input.source);\n\treturn input;\n};\n\nconst val = (input) => {\n\tinput = src(input);\n\treturn number(input) ? input : escapeRegExp(input);\n};\n\nconst compositions = {\n\tbeginningOfInput: '^',\n\tendOfInput: '$',\n\tanySingleCharExceptTheNewline: '.',\n\tanySingleChar: '[\\\\s\\\\S]',\n\tsomethingExceptTheNewline: '(?:.+)',\n\tsomething: '(?:[\\\\s\\\\S]+)',\n\tanythingExceptTheNewline: '(?:.*)',\n\tanything: '(?:[\\\\s\\\\S]*)',\n\tzeroOrMoreTimes: '*',\n\toneOrMoreTimes: '+',\n\tzeroOrOneTime: '?',\n\tor: '|',\n\tescape: '\\\\',\n\tbackslash: '\\\\',\n\tbackspace: '[\\\\b]',\n\twordBoundary: '\\\\b',\n\tnonWordBoundary: '\\\\B',\n\tdigit: '\\\\d',\n\tnonDigit: '\\\\D',\n\tformFeed: '\\\\f',\n\tlineFeed: '\\\\n',\n\tlineBreak: '\\\\r\\\\n?|\\\\n|\\\\u2028|\\\\u2029',\n\tcarriageReturn: '\\\\r',\n\twhiteSpace: '\\\\s',\n\tnotWhiteSpace: '\\\\S',\n\tnonASCIIWhiteSpace: '[\\\\u1680\\\\u180e\\\\u2000-\\\\u200a\\\\u202f\\\\u205f\\\\u3000\\\\ufeff]',\n\ttab: '\\\\t',\n\tverticalTab: '\\\\v',\n\talphanumeric: '\\\\w',\n\talphanumerical: '\\\\w',\n\tnonWord: '\\\\W',\n\tnul: '\\\\0',\n\tnil: '\\\\0',\n\tlowercase: '[a-z]',\n\tuppercase: '[A-Z]',\n\tletter: '[a-zA-Z]',\n\tnumeric: '[0-9]',\n\tvarchar: '[a-zA-Z_$][0-9a-zA-Z_$]',\n\teol: '(?:(?:\\\\n)|(?:\\\\r\\\\n))',\n\tstartCapture: '(',\n\tendCapture: ')',\n\tstartGroup: '(',\n\tendGroup: ')',\n\tstartCharset: '[',\n\tendCharset: ']',\n\tmodifier: (self, last, input) => `${self}(?${input})`,\n\tquote: (self, last, input) => `${self}${val(input)}`,\n\tvalue: (self, last, input) => `${self}${src(input)}`,\n\tplus: (self, last, input) => `${self}${src(input)}`,\n\tunicode: (self, last, input) => `${self}\\\\u${input}`,\n\tcontrol: (self, last, input) => `${self}\\\\c${input}`,\n\tnotRemember: (self, last, input) => `${self}(?:${src(input)})`,\n\tthen: (self, last, input) => `${self}(?:${src(input)})`,\n\tfind: (self, last, input) => `${self}(?:${src(input)})`,\n\tmaybe: (self, last, input) => `${self}(?:${src(input)})*`,\n\tmaybeOne: (self, last, input) => `${self}(?:${src(input)})?`,\n\tifFollowedBy: (self, last, input) => `${self}(?=${src(input)})`,\n\tifNotFollowedBy: (self, last, input) => `${self}(?!${src(input)})`,\n\tanythingBut: (self, last, input) => `${self}(?:[^${src(input)}]*)`,\n\tsomethingBut: (self, last, input) => `${self}(?:[^${src(input)}]+)`,\n\tnotCharset: (self, last, input) => `${self}[^${src(input)}]`,\n\tcharset: (self, last, input) => `${self}[${src(input)}]`,\n\tany: (self, last, input) => `${self}[${src(input)}]`,\n\tanyOf: (self, last, input) => `${self}[${src(input)}]`,\n\tgroup: (self, last, input) => `${self}(${src(input)})`,\n\tsize: (self, last, input) => `${self}{${0 | input}}`,\n\tatLeast: (self, last, input) => `${self}{${0 | input},}`,\n\tatMost: (self, last, input) => `${self}{,${0 | input}}`,\n\trange: (self, last, min, max) => `${self}{${0 | min},${0 | max}}`,\n\trepeat: (self, last, times) => `${self}${new Array((0 | times) + 1).join(last)}`,\n\treplace: (self, last, pattern, replacement) => self.replace(pattern, replacement),\n\tflags: (self, last, input) => new RegExp(self, input),\n\teither: (self, last, ...rest) => `${self}${rest.join('|')}`,\n};\n\nconst { assign } = Object;\nconst match = objectChain(compositions);\nconst rules = (custom, override, middleware) => {\n\tif (custom === undefined || custom === null) return match;\n\treturn objectChain(assign({}, custom, compositions, override), middleware);\n};\n\nexport { rules, match, src, val };\n"],"names":["array","escapeRegExp"],"mappings":";;;;;;;;;;;;;;;;oTAOe,CAAA,kDCIPA,CAAAA,s0CCoCwB,CAAA,obC1BAC,CAAAA"} \ No newline at end of file +{"version":3,"file":"index.min.js","sources":["node_modules/describe-type/source/is/array.js","node_modules/describe-type/source/is/arraylike.js","node_modules/object-chain/index.next.js","index.next.js"],"sourcesContent":["/**\n *\n * @function\n * @memberof is\n * @param {any} value\n * @returns {Boolean}\n */\nexport default function array(value) {\n\tif (value == null) return false;\n\treturn value.constructor === Array;\n}\n","import array from './array.js';\nimport string from './string.js';\n\n/**\n *\n * @function\n * @memberof is\n * @param {any} value\n * @returns {Boolean}\n */\nexport default function arraylike(value) {\n\treturn array(value) || string(value) || (\n\t\t(!!value && typeof value === 'object' && typeof value.length === 'number') &&\n\t\t(value.length === 0 || (value.length > 0 && (value.length - 1) in value))\n\t);\n}\n","import callable from 'describe-type/source/is/callable.js';\nimport apply from 'describe-type/source/@/apply.js';\n\nconst { setPrototypeOf, defineProperties, create, keys } = Object;\nconst arrayFrom = Array.from;\n\nconst processArgs = (args, initialValue) => (\n\tarrayFrom(args).reduce((acc, arg) => {\n\t\tacc[acc.length] = callable(arg) ? arg() : arg;\n\t\treturn acc;\n\t}, initialValue)\n);\n\nconst transform = (object, middleware) => {\n\tfunction chain() {\n\t\tlet last = '';\n\t\tconst pattern = this.object.reduce((acc, item) => {\n\t\t\tif (callable(object[item.name])) {\n\t\t\t\tconst args = processArgs(item.args, [acc, last]);\n\t\t\t\tacc = apply(object[item.name], this, args);\n\t\t\t\tlast = acc;\n\t\t\t} else {\n\t\t\t\tacc += object[item.name];\n\t\t\t\tlast = object[item.name];\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, last);\n\t\treturn middleware ? apply(middleware, this, [pattern, arguments], true) : pattern;\n\t}\n\n\tfunction connect(data) {\n\t\tfunction link() { return apply(chain, link, arguments); }\n\t\tlink.object = data;\n\t\tsetPrototypeOf(link, proto);\n\t\treturn link;\n\t}\n\n\tconst descriptors = keys(object).reduce((acc, name) => {\n\t\tconst isfn = callable(object[name]);\n\t\tacc[name] = {\n\t\t\t[isfn ? 'value' : 'get']: function connector() {\n\t\t\t\treturn connect(this.object.concat({ name, args: arguments }));\n\t\t\t},\n\t\t};\n\t\treturn acc;\n\t}, create(null));\n\n\tconst proto = defineProperties(function ObjectChain() {}, descriptors);\n\treturn defineProperties({ object }, keys(descriptors).reduce((acc, name) => {\n\t\tconst isfn = callable(object[name]);\n\t\tacc[name] = {\n\t\t\t[isfn ? 'value' : 'get']: function startup() {\n\t\t\t\treturn connect([{ name, args: arguments }]);\n\t\t\t},\n\t\t};\n\t\treturn acc;\n\t}, create(null)));\n};\n\nexport default transform;\n","import number from 'describe-type/source/is/number';\nimport string from 'describe-type/source/is/string';\nimport objectChain from 'object-chain';\n\nconst reEscapeRegExp = /[-[/\\]{}()*+?.,\\\\^$|#\\s]/g;\n\nconst escapeRegExp = (input) => {\n\tinput = string(input) ? input : '';\n\treEscapeRegExp.lastIndex = 0;\n\treturn input.replace(reEscapeRegExp, '\\\\$&');\n};\n\nconst src = (input) => {\n\tif (input === undefined) return 'undefined';\n\tif (input === null) return 'null';\n\tif (input.source) return src(input.source);\n\treturn input;\n};\n\nconst val = (input) => {\n\tinput = src(input);\n\treturn number(input) ? input : escapeRegExp(input);\n};\n\nconst compositions = {\n\tbeginningOfInput: '^',\n\tendOfInput: '$',\n\tanySingleCharExceptTheNewline: '.',\n\tanySingleChar: '[\\\\s\\\\S]',\n\tsomethingExceptTheNewline: '(?:.+)',\n\tsomething: '(?:[\\\\s\\\\S]+)',\n\tanythingExceptTheNewline: '(?:.*)',\n\tanything: '(?:[\\\\s\\\\S]*)',\n\tzeroOrMoreTimes: '*',\n\toneOrMoreTimes: '+',\n\tzeroOrOneTime: '?',\n\tor: '|',\n\tescape: '\\\\',\n\tbackslash: '\\\\',\n\tbackspace: '[\\\\b]',\n\twordBoundary: '\\\\b',\n\tnonWordBoundary: '\\\\B',\n\tdigit: '\\\\d',\n\tnonDigit: '\\\\D',\n\tformFeed: '\\\\f',\n\tlineFeed: '\\\\n',\n\tlineBreak: '\\\\r\\\\n?|\\\\n|\\\\u2028|\\\\u2029',\n\tcarriageReturn: '\\\\r',\n\twhiteSpace: '\\\\s',\n\tnotWhiteSpace: '\\\\S',\n\tnonASCIIWhiteSpace: '[\\\\u1680\\\\u180e\\\\u2000-\\\\u200a\\\\u202f\\\\u205f\\\\u3000\\\\ufeff]',\n\ttab: '\\\\t',\n\tverticalTab: '\\\\v',\n\talphanumeric: '\\\\w',\n\talphanumerical: '\\\\w',\n\tnonWord: '\\\\W',\n\tnul: '\\\\0',\n\tnil: '\\\\0',\n\tlowercase: '[a-z]',\n\tuppercase: '[A-Z]',\n\tletter: '[a-zA-Z]',\n\tnumeric: '[0-9]',\n\tvarchar: '[a-zA-Z_$][0-9a-zA-Z_$]',\n\teol: '(?:(?:\\\\n)|(?:\\\\r\\\\n))',\n\tstartCapture: '(',\n\tendCapture: ')',\n\tstartGroup: '(',\n\tendGroup: ')',\n\tstartCharset: '[',\n\tendCharset: ']',\n\tquote: (self, last, input) => `${self}${val(input)}`,\n\tvalue: (self, last, input) => `${self}${src(input)}`,\n\tplus: (self, last, input) => `${self}${src(input)}`,\n\tunicode: (self, last, input) => `${self}\\\\u${input}`,\n\tcontrol: (self, last, input) => `${self}\\\\c${input}`,\n\tnotRemember: (self, last, input) => `${self}(?:${src(input)})`,\n\tthen: (self, last, input) => `${self}(?:${src(input)})`,\n\tfind: (self, last, input) => `${self}(?:${src(input)})`,\n\tmaybe: (self, last, input) => `${self}(?:${src(input)})*`,\n\tmaybeOne: (self, last, input) => `${self}(?:${src(input)})?`,\n\tifFollowedBy: (self, last, input) => `${self}(?=${src(input)})`,\n\tifNotFollowedBy: (self, last, input) => `${self}(?!${src(input)})`,\n\tanythingBut: (self, last, input) => `${self}(?:[^${src(input)}]*)`,\n\tsomethingBut: (self, last, input) => `${self}(?:[^${src(input)}]+)`,\n\tnotCharset: (self, last, input) => `${self}[^${src(input)}]`,\n\tcharset: (self, last, input) => `${self}[${src(input)}]`,\n\tany: (self, last, input) => `${self}[${src(input)}]`,\n\tanyOf: (self, last, input) => `${self}[${src(input)}]`,\n\tgroup: (self, last, input) => `${self}(${src(input)})`,\n\tsize: (self, last, input) => `${self}{${0 | input}}`,\n\tatLeast: (self, last, input) => `${self}{${0 | input},}`,\n\tatMost: (self, last, input) => `${self}{,${0 | input}}`,\n\trange: (self, last, min, max) => `${self}{${0 | min},${0 | max}}`,\n\trepeat: (self, last, times) => `${self}${new Array((0 | times) + 1).join(last)}`,\n\treplace: (self, last, pattern, replacement) => self.replace(pattern, replacement),\n\tflags: (self, last, input) => new RegExp(self, input),\n\teither: (self, last, ...rest) => `${self}${rest.join('|')}`,\n};\n\nconst { assign } = Object;\nconst match = objectChain(compositions);\nconst rules = (custom, override, middleware) => {\n\tif (custom === undefined || custom === null) return match;\n\treturn objectChain(assign({}, custom, compositions, override), middleware);\n};\n\nexport { rules, match, src, val };\n"],"names":["array","escapeRegExp"],"mappings":";;;;;;;;;;;;;;;;oTAOe,CAAA,kDCIPA,CAAAA,s0CCoCwB,CAAA,obC1BAC,CAAAA"} \ No newline at end of file diff --git a/index.next.js b/index.next.js index 1f840d1..6bf0f5d 100644 --- a/index.next.js +++ b/index.next.js @@ -68,7 +68,6 @@ const compositions = { endGroup: ')', startCharset: '[', endCharset: ']', - modifier: (self, last, input) => `${self}(?${input})`, quote: (self, last, input) => `${self}${val(input)}`, value: (self, last, input) => `${self}${src(input)}`, plus: (self, last, input) => `${self}${src(input)}`,