Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wmfs/cardscript-expressions
https://github.com/wmfs/cardscript-expressions
cardscript tymly
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/wmfs/cardscript-expressions
- Owner: wmfs
- License: mit
- Created: 2019-01-18T08:28:14.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-09-13T16:10:42.000Z (5 months ago)
- Last Synced: 2024-09-14T07:07:54.671Z (4 months ago)
- Topics: cardscript, tymly
- Language: JavaScript
- Size: 186 KB
- Stars: 0
- Watchers: 7
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# cardscript-expressions
[![Tymly Cardscript](https://img.shields.io/badge/tymly-cardscript-blue.svg)](https://tymly.io/)
[![CircleCI](https://circleci.com/gh/wmfs/cardscript-expressions.svg?style=svg)](https://circleci.com/gh/wmfs/cardscript-expressions)
[![npm (scoped)](https://img.shields.io/npm/v/@wmfs/cardscript-expressions.svg)](https://www.npmjs.com/package/@wmfs/cardscript-expressions)
[![codecov](https://codecov.io/gh/wmfs/cardscript-expressions/branch/master/graph/badge.svg)](https://codecov.io/gh/wmfs/cardscript-expressions)
[![CodeFactor](https://www.codefactor.io/repository/github/wmfs/cardscript-expressions/badge)](https://www.codefactor.io/repository/github/wmfs/cardscript-expressions)
[![Dependabot badge](https://img.shields.io/badge/Dependabot-active-brightgreen.svg)](https://dependabot.com/)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
[![license](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/wmfs/tymly/blob/master/packages/concrete-paths/LICENSE)> cardscript-expressions provides a number of utilities to generate expressions, generate AST's, and clean cardscript data for submissions
## Install
```bash
$ npm install cardscript-expressions --save
```## Usage
```bash
const expressions = new CardscriptExpressionsxpressions()
```##### Method summary
| Usage | Description |
| ----------- | ----------- |
| `const expressionList = getExpressionsFromCardscript(cardscript)` | Takes a cardscript schema and extracts a list of expressions. |
| `convertExpressionsToAst(expressions)`| Takes a list of expressions generated by `getExpressionsFromCardscript()` and amends the generated AST's to an object `asts` available from `expressions.asts` |
| `addCardscript(cardscript)` | A combination of `getExpressionsFromCardscript(cardscript)` and `convertExpressionsToAst(expressions)`, used to generate AST's from cardscript in one function call |
| `const visibilityList = calculateWidgetVisibility(cardscript, data, asts)` | Takes a cardscript schema, submission data, and a list of AST's to generate an object of `{key: boolean}` values representing whether a widget should be visible or not |
| `const clean = cleanData(data, visibilityList)`| Takes submission data and a visibility list generated by `calculateWidgetVisibility` and returns a cleaned data object with values of hidden fields removed |## License
[MIT](https://github.com/wmfs/cardscript/blob/master/LICENSE)