Skip to content

Commit

Permalink
Updating README
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Cox authored and Dan Cox committed Dec 24, 2023
1 parent 02884a3 commit 73871d0
Show file tree
Hide file tree
Showing 5 changed files with 168 additions and 166 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ module.exports = {
parserOptions: {
ecmaVersion: 'latest'
},
rules: {
"rules": {
"semi": ["error", "always"]
},
plugins: [
"mocha"
Expand Down
41 changes: 33 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

*Lightweight (~11 KiB) story sorting DSL.*

Based on the Latin word *quis*, this project, like its origin, implies a question of existing complex data. Quis provides a domain specific language (DSL) for performing comparisons on values within a state or global collection using strings.
Based on the Latin word *quis*, this project, like its origin, implies a question of existing complex data. Quis provides a domain specific language (DSL) for performing comparisons on values within a collection using string-based comparisons.

<<<<<<< HEAD
Primarily, Quis is designed story sorting for use with quality-based or storylet structures where comparisons are needed to select or sort narrative content.
=======
Primarily, Quis is designed for story sorting with quality-based or storylet structures where comparisons are needed to select or otherwise act on narrative modules. It uses a Parsing Expression Grammar (PEG) to define possible JavaScript and shorthand conditional comparisons:
Quis is designed for story sorting with dynamic narrative structures where comparisons are needed to select or sort content. It uses a Parsing Expression Grammar (PEG) to define possible JavaScript and shorthand conditional comparisons:

## Comparisons

- `==` / `is` Equality.
- `!=` / `is not` Inequality.
Expand All @@ -18,6 +17,33 @@ Primarily, Quis is designed for story sorting with quality-based or storylet str
- `and` Boolean AND
- `or` Boolean OR

## Values Collection

To be as lightweight as possible, Quis does not contain state or database functionality. This must be provided by developers while also matching the expected callback structure expected.

Based on the underlining PEG compilation process, Quis expects a *values()* callback function returning values based on the passed-in variable name. For example, a simple collection returning specific values based on labels might be the following:

```javascript
const values = (label) => {

// Establish a default value.
let result = null;

// Return value based on 'example'.
if (label === 'example') {
result = 2;
}

// Return value based on 'example2'.
if (label === 'example2') {
result = 5;
}

// Return either default or set value.
return result;
};
```

## Build

- `build/quis.js (40.1 KiB)`
Expand All @@ -27,9 +53,9 @@ Primarily, Quis is designed for story sorting with quality-based or storylet str

```js
// Import parse() function.
const { parse } = require('./build/quis.js');
const { parse } = require('quis');

// Create a values function. (This must be a function returning a value.)
// Create a values function. (This must be a callback returning a value.)
const values = (label) => {
if(label == 'example') {
return 2;
Expand Down Expand Up @@ -58,4 +84,3 @@ const results = content.filter(
console.log(results);

```
>>>>>>> a822d9af3e8627e97e06dbbcb621b85238de9d8b
13 changes: 0 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,9 @@
"main": "index.js",
"scripts": {
"test": "mocha",
<<<<<<< HEAD
"compile": "peggy -o build/quis.js ./src/dsl.pegjs",
"lint": "eslint ./src --fix"
=======
"compile": "peggy -o ./build/quis.js ./src/dsl.pegjs",
"build": "npx webpack",
"lint": "eslint ./test --fix"
>>>>>>> a822d9af3e8627e97e06dbbcb621b85238de9d8b
},
"author": "Dan Cox",
"license": "MIT",
Expand All @@ -24,16 +19,10 @@
"eslint": "^8.56.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
<<<<<<< HEAD
"eslint-plugin-n": "^16.5.0",
"eslint-plugin-promise": "^6.1.1",
"mocha": "*"
=======
"eslint-plugin-mocha": "^10.2.0",
"eslint-plugin-n": "^16.4.0",
"eslint-plugin-promise": "^6.1.1",
"mocha": "*",
"webpack-cli": "^5.1.4"
>>>>>>> a822d9af3e8627e97e06dbbcb621b85238de9d8b
}
}
Loading

0 comments on commit 73871d0

Please sign in to comment.