2.0.11 • Published 15 days ago

selectively v2.0.11

Weekly downloads
197
License
MIT
Repository
github
Last release
15 days ago

template-library

Template for NPM library.

Selectively Grammar

Symbols

  • bool-expr (boolean expression)
  • prop (property, identifier (id) or combination of identifiers, e.g. identifier.identifier (id.id))
  • id (identifier)
  • expr (expression)
  • expr-op (expression operator e.g. >, <, >=, <=)
  • alg-expr (algebraic expression)
  • bin-op (binary operator)

Production Rules

Boolean Rules:

  • bool-expr -> prop ":" expr | prop expr-op expr | (bool-expr) | bool-expr "|" bool-expr | bool-expr bool-expr | !bool-expr
  • prop -> prop "." id | id
  • expr -> prop | string | alg-expr | (expr) | "!"expr | expr "|" expr
  • expr-op -> < | > | <= | >=

Algebraic Rules:

  • alg-expr -> number | alg-expr bin-op alg-expr | (alg-expr)
  • bin-op -> + | - | / | *

Merchant Rules

All id could be id.id.id...

Allowed Strings

id>num  
id<=str  
!(id:str)  
id:(str | str)  
id:((str | str) | str)  
(id<num)  
id:num  
id:!num  
id:!(num | num)  
id:(num | !num)  
id:id  
id>id  
(((id>num)))  
(id>(num))  
id.id:(id.id | str | num) | id.id.id:id.id  
id>num + num  
id<= num + (num * num) / num - num

Disallowed Strings

Open brackets:

(((id>num))

Mix of prop ":" expr and prop expr-op expr

id:(id>num)   

Special Rules

prop expr-op expr

Left-hand side:

Can be ambiguous, e.g. amount, where amount is an identifier which can be found as a property on several properties.

Right-hand side:

Can't be ambiguous, it must refer to a string, number or a unique identifier, e.g. "uniqueIdentifier.amount". An ambiguous identifier will be interpreted as a string. 

What is What?

  • 3.14 => number
  • identifier | identifier.identifier => property or properties
  • unique_identifier.identifier => property
  • .identifier => property if the identifier is a property of the base object, otherwise string.
  • 1.B2 => string
  • card.3d.secure => property
  • 20-12-24 => string
  • 20 - 12 - 24 => algebraic expression (uses whitespaces around the operators.)
  • "20 - 12 - 24" => string. ("" forces an)
  • Violation of the rules gives red underlining.
2.0.11

15 days ago

2.0.10

2 months ago

2.0.7

7 months ago

2.0.9

6 months ago

2.0.8

7 months ago

2.0.5

7 months ago

2.0.6

7 months ago

2.0.3

1 year ago

2.0.4

1 year ago

2.0.2

2 years ago

2.0.1

2 years ago

0.0.70

2 years ago

0.0.69

2 years ago

0.0.67

3 years ago

0.0.68

3 years ago

0.0.66

3 years ago

0.0.65

3 years ago

0.0.64

3 years ago

0.0.63

3 years ago

0.0.62

3 years ago

0.0.61

3 years ago

0.0.60

3 years ago

0.0.59

3 years ago

0.0.51

3 years ago

0.0.52

3 years ago

0.0.53

3 years ago

0.0.54

3 years ago

0.0.55

3 years ago

0.0.56

3 years ago

0.0.57

3 years ago

0.0.58

3 years ago

0.0.50

3 years ago

0.0.48

3 years ago

0.0.49

3 years ago

0.0.46

3 years ago

0.0.47

3 years ago

0.0.44

3 years ago

0.0.45

3 years ago

0.0.43

3 years ago

0.0.40

3 years ago

0.0.41

3 years ago

0.0.42

3 years ago

0.0.39

3 years ago

0.0.38

3 years ago

0.0.37

3 years ago

0.0.36

3 years ago

0.0.35

3 years ago

0.0.34

3 years ago

0.0.33

3 years ago

0.0.30

3 years ago

0.0.31

3 years ago

0.0.32

3 years ago

0.0.29

3 years ago

0.0.28

3 years ago

0.0.27

3 years ago

0.0.26

3 years ago

0.0.25

3 years ago

0.0.23

3 years ago

0.0.24

3 years ago

0.0.22

3 years ago

0.0.21

3 years ago

0.0.20

4 years ago

0.0.19

4 years ago

0.0.18

4 years ago

0.0.17

4 years ago

0.0.13

4 years ago

0.0.14

4 years ago

0.0.15

4 years ago

0.0.16

4 years ago

0.0.12

4 years ago

0.0.11

4 years ago

0.0.10

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago