Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@gram-data/gram-stringify

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gram-data/gram-stringify - npm Package Compare versions

Comparing version 0.2.8 to 0.2.9

2

dist/gram-stringify.umd.development.js

@@ -99,3 +99,3 @@ (function (global, factory) {

var isLiteral = function isLiteral(o) {
return !!o.type && !!o.value;
return !!o.type && !!o.value && o.type !== 'property';
};

@@ -102,0 +102,0 @@

@@ -1,2 +0,2 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(((e=e||self).gram=e.gram||{},e.gram.stringify={}))}(this,(function(e){"use strict";var n=function(e){return!!e.type&&"path"===e.type},t=function(e){return n(e)&&void 0===e.children&&"ø"===e.id},r=function(e){return n(e)&&e.children&&0===e.children.length&&"ø"!==e.id},i=function(e){return n(e)&&void 0!==e.relation&&"pair"!==e.relation&&void 0!==e.children&&e.children.every((function(e){return r(e)}))},o=function(e){return!!e.type&&!!e.value},l=function(e){switch(e.type){case"integer":return e.value;case"string":return"`"+e.value+"`";case"tagged":return e.tag+"`"+e.value+"`";default:return"<ERROR, can't stringify literals of type "+e.type+">"}},u=function(e){return"{"+e.map((function(e,n){return(n>0?",":"")+e.name+":"+(function(e){return Array.isArray(e)&&o(e[0])}(t=e.value)?"["+t.map((function(e){return l(e)})).join(",")+"]":o(t)?l(t):u(t));var t})).join("")+"}"},c=function(e){var n=e.id||"",t=e.labels&&e.labels.length>0?":"+e.labels.join(":"):"",r=e.record&&0!==Object.keys(e.record).length?u(e.record):"";return""+n+t+(((n.length>0||t.length>0)&&r.length)>0?" ":"")+r},a=function(e){return"("+c(e)+")"},f=function(e){return e?""+(t(e)?"":r(e)?a(e):i(e)?function e(n){var t="left"===n.relation?"<-":"-",i="right"===n.relation?"->":"-",o=r(n.children[0])?a(n.children[0]):e(n.children[0]),l=r(n.children[1])?a(n.children[1]):e(n.children[1]),u=c(n);return""+o+t+(u.length>0?"["+u+"]":"")+i+l}(e):function(e){var n=e.children&&e.children.length>0?f(e.children[0]):"",t=e.children&&e.children.length>1?f(e.children[1]):"",r="left"===e.relation?"<--":"right"===e.relation?"--\x3e":"either"===e.relation?"--":n.length>0&&t.length>0?",":"";return"["+c(e)+(r.length>0?" ":"")+r+(n.length>0?" ":"")+n+(t.length>0?" ":"")+t+"]"}(e)):""},h=function e(n){switch(n.type){case"seq":return n.children.map((function(n){return e(n)})).join("\n");case"path":return f(n);default:console.error("Impossible:",typeof n)}return[].join("")},d=function(e){return n(o=e)||t(o)||r(o)||i(o)||function(e){return!!e.type&&"seq"===e.type}(o)?h(e):"Don't know how to stringify \""+e.type+'" nodes';var o};e.gramStringifyPlugin=function(){this.Compiler=d},e.stringify=h,e.toGram=h,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(((e=e||self).gram=e.gram||{},e.gram.stringify={}))}(this,(function(e){"use strict";var n=function(e){return!!e.type&&"path"===e.type},t=function(e){return n(e)&&void 0===e.children&&"ø"===e.id},r=function(e){return n(e)&&e.children&&0===e.children.length&&"ø"!==e.id},i=function(e){return n(e)&&void 0!==e.relation&&"pair"!==e.relation&&void 0!==e.children&&e.children.every((function(e){return r(e)}))},o=function(e){return!!e.type&&!!e.value&&"property"!==e.type},l=function(e){switch(e.type){case"integer":return e.value;case"string":return"`"+e.value+"`";case"tagged":return e.tag+"`"+e.value+"`";default:return"<ERROR, can't stringify literals of type "+e.type+">"}},u=function(e){return"{"+e.map((function(e,n){return(n>0?",":"")+e.name+":"+(function(e){return Array.isArray(e)&&o(e[0])}(t=e.value)?"["+t.map((function(e){return l(e)})).join(",")+"]":o(t)?l(t):u(t));var t})).join("")+"}"},c=function(e){var n=e.id||"",t=e.labels&&e.labels.length>0?":"+e.labels.join(":"):"",r=e.record&&0!==Object.keys(e.record).length?u(e.record):"";return""+n+t+(((n.length>0||t.length>0)&&r.length)>0?" ":"")+r},a=function(e){return"("+c(e)+")"},f=function(e){return e?""+(t(e)?"":r(e)?a(e):i(e)?function e(n){var t="left"===n.relation?"<-":"-",i="right"===n.relation?"->":"-",o=r(n.children[0])?a(n.children[0]):e(n.children[0]),l=r(n.children[1])?a(n.children[1]):e(n.children[1]),u=c(n);return""+o+t+(u.length>0?"["+u+"]":"")+i+l}(e):function(e){var n=e.children&&e.children.length>0?f(e.children[0]):"",t=e.children&&e.children.length>1?f(e.children[1]):"",r="left"===e.relation?"<--":"right"===e.relation?"--\x3e":"either"===e.relation?"--":n.length>0&&t.length>0?",":"";return"["+c(e)+(r.length>0?" ":"")+r+(n.length>0?" ":"")+n+(t.length>0?" ":"")+t+"]"}(e)):""},h=function e(n){switch(n.type){case"seq":return n.children.map((function(n){return e(n)})).join("\n");case"path":return f(n);default:console.error("Impossible:",typeof n)}return[].join("")},d=function(e){return n(o=e)||t(o)||r(o)||i(o)||function(e){return!!e.type&&"seq"===e.type}(o)?h(e):"Don't know how to stringify \""+e.type+'" nodes';var o};e.gramStringifyPlugin=function(){this.Compiler=d},e.stringify=h,e.toGram=h,Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=gram-stringify.umd.production.min.js.map

@@ -8,3 +8,3 @@ {

],
"version": "0.2.8",
"version": "0.2.9",
"license": "MIT",

@@ -52,8 +52,8 @@ "repository": {

"devDependencies": {
"@gram-data/gram-builder": "^0.2.8",
"@gram-data/gram-builder": "^0.2.9",
"@types/jest": "^26.0.15",
"@types/unist": "^2.0.3",
"@typescript-eslint/parser": "^4.6.0",
"@typescript-eslint/parser": "^4.8.1",
"husky": "^4.3.0",
"npm-check-updates": "^9.2.3",
"npm-check-updates": "^10.2.1",
"npm-run-all": "^4.1.5",

@@ -70,6 +70,6 @@ "rollup-plugin-node-builtins": "^2.1.2",

"dependencies": {
"@gram-data/gram-ast": "^0.2.8",
"@gram-data/gram-ast": "^0.2.9",
"unified": "^9.2.0"
},
"gitHead": "3d28a7b7186d406e75bfd22aac54cd1b4ba0dbfa",
"gitHead": "1ff6bdb1c799a29a95540314bdb5b2a881971774",
"publishConfig": {

@@ -76,0 +76,0 @@ "access": "public"

@@ -7,3 +7,3 @@ From gram AST to text literal `(a)-->(b)`.

```
``` bash
npm install @gram-data/gram-stringify

@@ -14,3 +14,3 @@ ```

```
``` TypeScript
import { node, edge } from '@gram-data/gram-builder';

@@ -28,3 +28,3 @@ import { stringify } from '@gram-data/gram-stringify';

```
``` TypeScript
import { toAST } from '@gram-data/gram-parse';

@@ -31,0 +31,0 @@ import { stringify } from '@gram-data/gram-stringify';

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc