@gram-data/gram-builder
Advanced tools
Comparing version 0.2.6 to 0.2.7
@@ -134,3 +134,2 @@ 'use strict'; | ||
var lhs = members[0]; | ||
var rhs = EMPTY_PATH; | ||
@@ -141,3 +140,3 @@ if (gramAst.isGramEmptyPath(lhs)) { | ||
} else { | ||
element.children = [lhs, rhs]; | ||
element.children = [lhs]; | ||
return element; | ||
@@ -144,0 +143,0 @@ } |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gram-data/gram-ast");function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function r(e){return Array.isArray(e)?e:e instanceof Function?r(e()):void 0===e?[]:[e]}var n=function(e,n,o,i){return t({type:"seq",id:n},o&&{labels:o},i&&{record:i},{children:r(e)})},o=function(e,t,r){return void 0===e&&(e="pair"),t.length>1?t.reduceRight((function(t,n){return i([n,t],{relation:e,id:r?""+r+0:void 0})}),a):t[0]},i=function(r,n){void 0===n&&(n={});var o=t({type:"path"},n.id&&{id:n.id},n.labels&&{labels:n.labels},n.record&&{record:n.record});if(void 0===r)return o.id&&o.id!==e.EMPTY_PATH_ID?(o.children=[],o):(o.children=void 0,a);if(0===r.length)return o.id===e.EMPTY_PATH_ID?a:(o.children=[],o);if(1===r.length){var i=r[0],u=a;return e.isGramEmptyPath(i)?(o.children=[],o):(o.children=[i,u],o)}if(2===r.length){if(n.relation&&"pair"!==n.relation&&e.isGramNode(r[0])&&e.isGramNode(r[1]))return o.relation=n.relation,o.children=[r[0],r[1]],o;if(e.isGramEmptyPath(r[0])&&e.isGramEmptyPath(r[1]))return o.relation=n.relation,o.children=[],o;o.children=[r[0],r[1]]}return o.relation=n.relation||"pair",o},a={type:"path",id:e.EMPTY_PATH_ID,labels:void 0,record:void 0,children:void 0},u=function(){return a},l=function(e,r,n){return t({type:"path"},e&&{id:e},r&&{labels:r},n&&{record:n},{children:[]})},d=function(e,r,n,o,i){return t({type:"path",id:n},o&&{labels:o},i&&{record:i},{relation:r,children:e})},c=function(e,r,n,o){return t({type:"path",id:r},n&&{labels:n},o&&{record:o},{children:e})},s=function(e){return e.reduce((function(e,t){return e[t.name]=t.value,e}),{})},p=function(e){return Object.entries(e).reduce((function(e,t){return e.push(f(t[0],t[1])),e}),[])},f=function(e,t){return{type:"property",name:e,value:t}},g=function(e){return{type:"boolean",value:e?"true":"false"}},h=function(e){return{type:"string",value:e}},m=function(e,t){return{type:"tagged",value:t,tag:e}},y=function(e){return{type:"integer",value:String(e)}},x=function(e){return{type:"decimal",value:String(e)}},v=function(e){return{type:"hexadecimal",value:"number"==typeof e?e.toString(16):e}},b=function(e){return{type:"octal",value:"number"==typeof e?e.toString(8):e}},P=function(e,t){return{type:"measurement",value:String(t),unit:e}},T=function(e){return m("date",e instanceof Date?e.getFullYear().toString():e)},_=function(e){return m("date",e instanceof Date?e.toISOString().slice(0,10):e)},M=function(e){return m("date",e instanceof Date?"--"+e.toISOString().slice(5,10):e)},S=function(e){return m("time",e instanceof Date?e.toTimeString():e)},D=function(e){return m("duration",e instanceof Date?"P"+(e.getUTCFullYear()-1970)+"Y"+e.getUTCMonth()+"M"+e.getUTCDate()+"DT"+e.getUTCHours()+"H"+e.getUTCMinutes()+"M"+e.getUTCMilliseconds()/1e3+"S":e)},O=function(e,t){return void 0===t&&(t=1),e.flat(t).filter((function(e){return null!==e}))},E={__proto__:null,seq:n,reduce:o,cons:i,EMPTY_PATH:a,empty:u,node:l,edge:d,path:c,reduceRecord:s,unfoldProperties:p,property:f,boolean:g,string:h,tagged:m,integer:y,decimal:x,hexadecimal:v,octal:b,measurement:P,year:T,date:_,dayOfMonth:M,time:S,duration:D,flatten:O,default:{seq:n,empty:u,cons:i,path:c,node:l,edge:d,property:f,boolean:g,string:h,tagged:m,integer:y,decimal:x,hexadecimal:v,octal:b,measurement:P,date:_,time:S,duration:D,flatten:O,reduceRecord:s,unfoldProperties:p}};exports.EMPTY_PATH=a,exports.boolean=g,exports.builder=E,exports.cons=i,exports.date=_,exports.dayOfMonth=M,exports.decimal=x,exports.duration=D,exports.edge=d,exports.empty=u,exports.flatten=O,exports.hexadecimal=v,exports.integer=y,exports.measurement=P,exports.node=l,exports.octal=b,exports.path=c,exports.property=f,exports.reduce=o,exports.reduceRecord=s,exports.seq=n,exports.string=h,exports.tagged=m,exports.time=S,exports.unfoldProperties=p,exports.year=T; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@gram-data/gram-ast");function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function r(e){return Array.isArray(e)?e:e instanceof Function?r(e()):void 0===e?[]:[e]}var n=function(e,n,o,i){return t({type:"seq",id:n},o&&{labels:o},i&&{record:i},{children:r(e)})},o=function(e,t,r){return void 0===e&&(e="pair"),t.length>1?t.reduceRight((function(t,n){return i([n,t],{relation:e,id:r?""+r+0:void 0})}),a):t[0]},i=function(r,n){void 0===n&&(n={});var o=t({type:"path"},n.id&&{id:n.id},n.labels&&{labels:n.labels},n.record&&{record:n.record});if(void 0===r)return o.id&&o.id!==e.EMPTY_PATH_ID?(o.children=[],o):(o.children=void 0,a);if(0===r.length)return o.id===e.EMPTY_PATH_ID?a:(o.children=[],o);if(1===r.length){var i=r[0];return e.isGramEmptyPath(i)?(o.children=[],o):(o.children=[i],o)}if(2===r.length){if(n.relation&&"pair"!==n.relation&&e.isGramNode(r[0])&&e.isGramNode(r[1]))return o.relation=n.relation,o.children=[r[0],r[1]],o;if(e.isGramEmptyPath(r[0])&&e.isGramEmptyPath(r[1]))return o.relation=n.relation,o.children=[],o;o.children=[r[0],r[1]]}return o.relation=n.relation||"pair",o},a={type:"path",id:e.EMPTY_PATH_ID,labels:void 0,record:void 0,children:void 0},u=function(){return a},l=function(e,r,n){return t({type:"path"},e&&{id:e},r&&{labels:r},n&&{record:n},{children:[]})},d=function(e,r,n,o,i){return t({type:"path",id:n},o&&{labels:o},i&&{record:i},{relation:r,children:e})},c=function(e,r,n,o){return t({type:"path",id:r},n&&{labels:n},o&&{record:o},{children:e})},s=function(e){return e.reduce((function(e,t){return e[t.name]=t.value,e}),{})},p=function(e){return Object.entries(e).reduce((function(e,t){return e.push(f(t[0],t[1])),e}),[])},f=function(e,t){return{type:"property",name:e,value:t}},g=function(e){return{type:"boolean",value:e?"true":"false"}},h=function(e){return{type:"string",value:e}},m=function(e,t){return{type:"tagged",value:t,tag:e}},y=function(e){return{type:"integer",value:String(e)}},x=function(e){return{type:"decimal",value:String(e)}},v=function(e){return{type:"hexadecimal",value:"number"==typeof e?e.toString(16):e}},b=function(e){return{type:"octal",value:"number"==typeof e?e.toString(8):e}},P=function(e,t){return{type:"measurement",value:String(t),unit:e}},T=function(e){return m("date",e instanceof Date?e.getFullYear().toString():e)},_=function(e){return m("date",e instanceof Date?e.toISOString().slice(0,10):e)},M=function(e){return m("date",e instanceof Date?"--"+e.toISOString().slice(5,10):e)},S=function(e){return m("time",e instanceof Date?e.toTimeString():e)},D=function(e){return m("duration",e instanceof Date?"P"+(e.getUTCFullYear()-1970)+"Y"+e.getUTCMonth()+"M"+e.getUTCDate()+"DT"+e.getUTCHours()+"H"+e.getUTCMinutes()+"M"+e.getUTCMilliseconds()/1e3+"S":e)},O=function(e,t){return void 0===t&&(t=1),e.flat(t).filter((function(e){return null!==e}))},E={__proto__:null,seq:n,reduce:o,cons:i,EMPTY_PATH:a,empty:u,node:l,edge:d,path:c,reduceRecord:s,unfoldProperties:p,property:f,boolean:g,string:h,tagged:m,integer:y,decimal:x,hexadecimal:v,octal:b,measurement:P,year:T,date:_,dayOfMonth:M,time:S,duration:D,flatten:O,default:{seq:n,empty:u,cons:i,path:c,node:l,edge:d,property:f,boolean:g,string:h,tagged:m,integer:y,decimal:x,hexadecimal:v,octal:b,measurement:P,date:_,time:S,duration:D,flatten:O,reduceRecord:s,unfoldProperties:p}};exports.EMPTY_PATH=a,exports.boolean=g,exports.builder=E,exports.cons=i,exports.date=_,exports.dayOfMonth=M,exports.decimal=x,exports.duration=D,exports.edge=d,exports.empty=u,exports.flatten=O,exports.hexadecimal=v,exports.integer=y,exports.measurement=P,exports.node=l,exports.octal=b,exports.path=c,exports.property=f,exports.reduce=o,exports.reduceRecord=s,exports.seq=n,exports.string=h,exports.tagged=m,exports.time=S,exports.unfoldProperties=p,exports.year=T; | ||
//# sourceMappingURL=gram-builder.cjs.production.min.js.map |
@@ -130,3 +130,2 @@ import { EMPTY_PATH_ID, isGramEmptyPath, isGramNode } from '@gram-data/gram-ast'; | ||
var lhs = members[0]; | ||
var rhs = EMPTY_PATH; | ||
@@ -137,3 +136,3 @@ if (isGramEmptyPath(lhs)) { | ||
} else { | ||
element.children = [lhs, rhs]; | ||
element.children = [lhs]; | ||
return element; | ||
@@ -140,0 +139,0 @@ } |
@@ -189,3 +189,2 @@ (function (global, factory) { | ||
var lhs = members[0]; | ||
var rhs = EMPTY_PATH; | ||
@@ -196,3 +195,3 @@ if (isGramEmptyPath(lhs)) { | ||
} else { | ||
element.children = [lhs, rhs]; | ||
element.children = [lhs]; | ||
return element; | ||
@@ -199,0 +198,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e=e||self).gram=e.gram||{},e.gram.builder={}))}(this,(function(e){"use strict";function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var n=function(e){return!!e.type&&"path"===e.type},r=function(e){return n(e)&&void 0===e.children&&"ø"===e.id},i=function(e){return n(e)&&e.children&&0===e.children.length&&"ø"!==e.id};function o(e){return Array.isArray(e)?e:e instanceof Function?o(e()):void 0===e?[]:[e]}var u=function(e,n,r,i){return t({type:"seq",id:n},r&&{labels:r},i&&{record:i},{children:o(e)})},a=function(e,t,n){return void 0===e&&(e="pair"),t.length>1?t.reduceRight((function(t,r){return d([r,t],{relation:e,id:n?""+n+0:void 0})}),l):t[0]},d=function(e,n){void 0===n&&(n={});var o=t({type:"path"},n.id&&{id:n.id},n.labels&&{labels:n.labels},n.record&&{record:n.record});if(void 0===e)return o.id&&"ø"!==o.id?(o.children=[],o):(o.children=void 0,l);if(0===e.length)return"ø"===o.id?l:(o.children=[],o);if(1===e.length){var u=e[0],a=l;return r(u)?(o.children=[],o):(o.children=[u,a],o)}if(2===e.length){if(n.relation&&"pair"!==n.relation&&i(e[0])&&i(e[1]))return o.relation=n.relation,o.children=[e[0],e[1]],o;if(r(e[0])&&r(e[1]))return o.relation=n.relation,o.children=[],o;o.children=[e[0],e[1]]}return o.relation=n.relation||"pair",o},l={type:"path",id:"ø",labels:void 0,record:void 0,children:void 0},c=function(){return l},f=function(e,n,r){return t({type:"path"},e&&{id:e},n&&{labels:n},r&&{record:r},{children:[]})},p=function(e,n,r,i,o){return t({type:"path",id:r},i&&{labels:i},o&&{record:o},{relation:n,children:e})},s=function(e,n,r,i){return t({type:"path",id:n},r&&{labels:r},i&&{record:i},{children:e})},g=function(e){return e.reduce((function(e,t){return e[t.name]=t.value,e}),{})},h=function(e){return Object.entries(e).reduce((function(e,t){return e.push(y(t[0],t[1])),e}),[])},y=function(e,t){return{type:"property",name:e,value:t}},m=function(e){return{type:"boolean",value:e?"true":"false"}},v=function(e){return{type:"string",value:e}},b=function(e,t){return{type:"tagged",value:t,tag:e}},S=function(e){return{type:"integer",value:String(e)}},T=function(e){return{type:"decimal",value:String(e)}},M=function(e){return{type:"hexadecimal",value:"number"==typeof e?e.toString(16):e}},P=function(e){return{type:"octal",value:"number"==typeof e?e.toString(8):e}},O=function(e,t){return{type:"measurement",value:String(t),unit:e}},_=function(e){return b("date",e instanceof Date?e.getFullYear().toString():e)},x=function(e){return b("date",e instanceof Date?e.toISOString().slice(0,10):e)},D=function(e){return b("date",e instanceof Date?"--"+e.toISOString().slice(5,10):e)},C=function(e){return b("time",e instanceof Date?e.toTimeString():e)},U=function(e){return b("duration",e instanceof Date?"P"+(e.getUTCFullYear()-1970)+"Y"+e.getUTCMonth()+"M"+e.getUTCDate()+"DT"+e.getUTCHours()+"H"+e.getUTCMinutes()+"M"+e.getUTCMilliseconds()/1e3+"S":e)},j=function(e,t){return void 0===t&&(t=1),e.flat(t).filter((function(e){return null!==e}))},Y={__proto__:null,seq:u,reduce:a,cons:d,EMPTY_PATH:l,empty:c,node:f,edge:p,path:s,reduceRecord:g,unfoldProperties:h,property:y,boolean:m,string:v,tagged:b,integer:S,decimal:T,hexadecimal:M,octal:P,measurement:O,year:_,date:x,dayOfMonth:D,time:C,duration:U,flatten:j,default:{seq:u,empty:c,cons:d,path:s,node:f,edge:p,property:y,boolean:m,string:v,tagged:b,integer:S,decimal:T,hexadecimal:M,octal:P,measurement:O,date:x,time:C,duration:U,flatten:j,reduceRecord:g,unfoldProperties:h}};e.EMPTY_PATH=l,e.boolean=m,e.builder=Y,e.cons=d,e.date=x,e.dayOfMonth=D,e.decimal=T,e.duration=U,e.edge=p,e.empty=c,e.flatten=j,e.hexadecimal=M,e.integer=S,e.measurement=O,e.node=f,e.octal=P,e.path=s,e.property=y,e.reduce=a,e.reduceRecord=g,e.seq=u,e.string=v,e.tagged=b,e.time=C,e.unfoldProperties=h,e.year=_,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e=e||self).gram=e.gram||{},e.gram.builder={}))}(this,(function(e){"use strict";function t(){return(t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var n=function(e){return!!e.type&&"path"===e.type},r=function(e){return n(e)&&void 0===e.children&&"ø"===e.id},i=function(e){return n(e)&&e.children&&0===e.children.length&&"ø"!==e.id};function o(e){return Array.isArray(e)?e:e instanceof Function?o(e()):void 0===e?[]:[e]}var u=function(e,n,r,i){return t({type:"seq",id:n},r&&{labels:r},i&&{record:i},{children:o(e)})},a=function(e,t,n){return void 0===e&&(e="pair"),t.length>1?t.reduceRight((function(t,r){return d([r,t],{relation:e,id:n?""+n+0:void 0})}),l):t[0]},d=function(e,n){void 0===n&&(n={});var o=t({type:"path"},n.id&&{id:n.id},n.labels&&{labels:n.labels},n.record&&{record:n.record});if(void 0===e)return o.id&&"ø"!==o.id?(o.children=[],o):(o.children=void 0,l);if(0===e.length)return"ø"===o.id?l:(o.children=[],o);if(1===e.length){var u=e[0];return r(u)?(o.children=[],o):(o.children=[u],o)}if(2===e.length){if(n.relation&&"pair"!==n.relation&&i(e[0])&&i(e[1]))return o.relation=n.relation,o.children=[e[0],e[1]],o;if(r(e[0])&&r(e[1]))return o.relation=n.relation,o.children=[],o;o.children=[e[0],e[1]]}return o.relation=n.relation||"pair",o},l={type:"path",id:"ø",labels:void 0,record:void 0,children:void 0},c=function(){return l},f=function(e,n,r){return t({type:"path"},e&&{id:e},n&&{labels:n},r&&{record:r},{children:[]})},p=function(e,n,r,i,o){return t({type:"path",id:r},i&&{labels:i},o&&{record:o},{relation:n,children:e})},s=function(e,n,r,i){return t({type:"path",id:n},r&&{labels:r},i&&{record:i},{children:e})},g=function(e){return e.reduce((function(e,t){return e[t.name]=t.value,e}),{})},h=function(e){return Object.entries(e).reduce((function(e,t){return e.push(y(t[0],t[1])),e}),[])},y=function(e,t){return{type:"property",name:e,value:t}},m=function(e){return{type:"boolean",value:e?"true":"false"}},v=function(e){return{type:"string",value:e}},b=function(e,t){return{type:"tagged",value:t,tag:e}},S=function(e){return{type:"integer",value:String(e)}},T=function(e){return{type:"decimal",value:String(e)}},M=function(e){return{type:"hexadecimal",value:"number"==typeof e?e.toString(16):e}},P=function(e){return{type:"octal",value:"number"==typeof e?e.toString(8):e}},O=function(e,t){return{type:"measurement",value:String(t),unit:e}},_=function(e){return b("date",e instanceof Date?e.getFullYear().toString():e)},x=function(e){return b("date",e instanceof Date?e.toISOString().slice(0,10):e)},D=function(e){return b("date",e instanceof Date?"--"+e.toISOString().slice(5,10):e)},C=function(e){return b("time",e instanceof Date?e.toTimeString():e)},U=function(e){return b("duration",e instanceof Date?"P"+(e.getUTCFullYear()-1970)+"Y"+e.getUTCMonth()+"M"+e.getUTCDate()+"DT"+e.getUTCHours()+"H"+e.getUTCMinutes()+"M"+e.getUTCMilliseconds()/1e3+"S":e)},j=function(e,t){return void 0===t&&(t=1),e.flat(t).filter((function(e){return null!==e}))},Y={__proto__:null,seq:u,reduce:a,cons:d,EMPTY_PATH:l,empty:c,node:f,edge:p,path:s,reduceRecord:g,unfoldProperties:h,property:y,boolean:m,string:v,tagged:b,integer:S,decimal:T,hexadecimal:M,octal:P,measurement:O,year:_,date:x,dayOfMonth:D,time:C,duration:U,flatten:j,default:{seq:u,empty:c,cons:d,path:s,node:f,edge:p,property:y,boolean:m,string:v,tagged:b,integer:S,decimal:T,hexadecimal:M,octal:P,measurement:O,date:x,time:C,duration:U,flatten:j,reduceRecord:g,unfoldProperties:h}};e.EMPTY_PATH=l,e.boolean=m,e.builder=Y,e.cons=d,e.date=x,e.dayOfMonth=D,e.decimal=T,e.duration=U,e.edge=p,e.empty=c,e.flatten=j,e.hexadecimal=M,e.integer=S,e.measurement=O,e.node=f,e.octal=P,e.path=s,e.property=y,e.reduce=a,e.reduceRecord=g,e.seq=u,e.string=v,e.tagged=b,e.time=C,e.unfoldProperties=h,e.year=_,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=gram-builder.umd.production.min.js.map |
@@ -8,4 +8,9 @@ { | ||
], | ||
"version": "0.2.6", | ||
"version": "0.2.7", | ||
"license": "MIT", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/gram-data/gram-js.git" | ||
}, | ||
"homepage": "https://github.com/gram-data/gram-js/tree/main/packages/gram-builder#readme", | ||
"main": "dist/index.js", | ||
@@ -22,3 +27,3 @@ "typings": "dist/index.d.ts", | ||
"start": "tsdx watch", | ||
"build": "tsdx build --format cjs,esm,umd", | ||
"build": "tsdx build --format umd,esm,cjs --tsconfig tsconfig.build.json", | ||
"test": "tsdx test", | ||
@@ -30,3 +35,5 @@ "test:watch": "tsdx test --watch", | ||
"demo": "serve ./public/", | ||
"prepare": "npm run build" | ||
"prepare": "npm run build", | ||
"update": "ncu -u", | ||
"update:check": "ncu" | ||
}, | ||
@@ -47,19 +54,21 @@ "husky": { | ||
"devDependencies": { | ||
"@types/jest": "^26.0.4", | ||
"@types/jest": "^26.0.15", | ||
"@types/unist": "^2.0.3", | ||
"@typescript-eslint/parser": "^3.6.1", | ||
"husky": "^4.2.5", | ||
"@typescript-eslint/parser": "^4.6.0", | ||
"husky": "^4.3.0", | ||
"npm-check-updates": "^9.2.3", | ||
"npm-run-all": "^4.1.5", | ||
"serve": "^11.3.2", | ||
"shx": "^0.3.2", | ||
"tsdx": "^0.13.2", | ||
"tslib": "^2.0.0", | ||
"typescript": "^3.9.7", | ||
"unist-util-inspect": "^6.0.0", | ||
"unist-util-size": "^2.0.0" | ||
"shx": "^0.3.3", | ||
"tsdx": "^0.14.1", | ||
"tslib": "^2.0.3", | ||
"typedoc": "^0.19.2", | ||
"typescript": "^4.0.5", | ||
"unist-util-inspect": "^6.0.1", | ||
"unist-util-size": "^2.0.1" | ||
}, | ||
"dependencies": { | ||
"@gram-data/gram-ast": "^0.2.6" | ||
"@gram-data/gram-ast": "^0.2.7" | ||
}, | ||
"gitHead": "0e76e336c21d916b2a79c4425b98578e645aa2c2", | ||
"gitHead": "68f323250363f0ab629388565880339d5c94ed5e", | ||
"publishConfig": { | ||
@@ -66,0 +75,0 @@ "access": "public" |
@@ -95,10 +95,10 @@ /** | ||
pathlist: GramPath[], | ||
baseID?: string, | ||
baseID?: string | ||
): GramPathlike => { | ||
let subID = 0; | ||
if (pathlist.length > 1) { | ||
return pathlist.reduceRight((acc:GramPathlike, curr) => { | ||
const childID = baseID ? `${baseID}${subID}` : undefined; | ||
return cons([curr, acc], { relation, id:childID }); | ||
}, EMPTY_PATH); | ||
return pathlist.reduceRight((acc: GramPathlike, curr) => { | ||
const childID = baseID ? `${baseID}${subID}` : undefined; | ||
return cons([curr, acc], { relation, id: childID }); | ||
}, EMPTY_PATH); | ||
} else { | ||
@@ -127,3 +127,3 @@ return pathlist[0]; | ||
if (members === undefined) { | ||
if (element.id && (element.id !== EMPTY_PATH_ID)) { | ||
if (element.id && element.id !== EMPTY_PATH_ID) { | ||
element.children = []; | ||
@@ -142,3 +142,2 @@ return element; | ||
const lhs = members[0]; | ||
const rhs = EMPTY_PATH; | ||
@@ -149,3 +148,3 @@ if (isGramEmptyPath(lhs)) { | ||
} else { | ||
element.children = [lhs, rhs]; | ||
element.children = [lhs]; | ||
return element as GramPath; | ||
@@ -161,8 +160,5 @@ } | ||
element.relation = attributes.relation; | ||
element.children =[members[0], members[1]]; | ||
element.children = [members[0], members[1]]; | ||
return element as GramEdge; | ||
} else if ( | ||
isGramEmptyPath(members[0]) && | ||
isGramEmptyPath(members[1]) | ||
) { | ||
} else if (isGramEmptyPath(members[0]) && isGramEmptyPath(members[1])) { | ||
element.relation = attributes.relation; | ||
@@ -186,3 +182,3 @@ element.children = []; | ||
record: undefined, | ||
children: undefined | ||
children: undefined, | ||
}; | ||
@@ -189,0 +185,0 @@ |
@@ -5,2 +5,2 @@ import * as builder from './gram-builder'; | ||
export {builder}; | ||
export { builder }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
1
140037
14
1751
Updated@gram-data/gram-ast@^0.2.7