npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

quara

v0.10.10

Published

Query as Sara.

Downloads

407

Readme

Quara - GitHub license Version size

Query as Sara

Don't use this in production: I may introduce breaking changes until version 1.0.0.

Programming language interpreted by JavaScript to preprocess text files like email templates.

About

  • Supported comments:
    • Line comments: // ...
    • Block comments: /* ... */
  • Supported operators:
    • +, -, *, /, %, ^, ¬/
    • =, +=, -=, *=, /=, %=, ^=
    • !, ==, !=, ~=, !~=, <, >, <=, >=, &&, ||
    • not, eq, ne, leq, lne, lt, gt, lte, gte, and, or
    • $not, $eq, $ne, $leq, $lne, $lt, $gt, $lte, $gte, $and, $or
    • (, )
    • ++, -- (as pre-increment and pre-decrement)
    • ., [, ]
    • .. (inclusive range operator)
    • ..< (exclusive range operator)
    • {, }
    • , (Comma)
    • ;, :
    • ->
    • ", `, \
    • in, $in
    • /if, /while, /for, /fn, /struct, /class, /interface, /enum
  • Supported types:
    • Booleans.
    • Integer and decimal numbers.
    • Strings.
    • Objects, arrays.
  • Variables.
  • Reserved keywords:
    • true, false
    • const, var
    • any, char, int, float, double, string, bool
    • if, else
    • while,
    • for,
    • fn, return,
    • null
    • enum
    • struct,
    • class, extends
    • get, set
    • static, abstract, final, virtual
    • private, public, protected
    • interface, implements

Variables and constants

var a = 14.10;
const b = "Query as Sara";
c = true; // var is optional unless you want to override an outer variable.

Objects

WIP: The operator ":" could be replaced by "=".

obj = {
  key1: 1,
  key2: 2
};
key = "key3";
print(obj.{key});
obj.{key} = 4;

Arrays

list = [1, 2, 3, 4, 5];
list.length; // 5
print(list[0]);
num = 2;
print(list[num]);
list[4] = 6;
list[num] = 7;
list.{4} = 6;

// TODO: Add support for this?
list.2 = 5;

Control

If/else

if condition {
  // ...
}
else if condition {
  // ...
}
else {
  // ...
}

if c {r}
else if c2 {r2}
else {r3}

if c -> r
else if c2 -> r2
else -> r3

While

while condition {
  // ...
}

while c {r}
while c: r /while;
while c -> r

For

for value, index in list {
  // ...
}

for list {...}
for value in list {...}
for value, index in list {...}

for list: ... /for;
for value in list: ... /for;
for value, index in list: ... /for;

for list -> /* One statement */;
for value in list -> /* One statement */;
for value, index in list -> /* One statement */;

List could be a range in any of the forms:

for i in 0..5 {
  // ...
}

Functions

WIP: At the moment, custom functions don't have arguments.

fn sum() {
  return a + b;
}

Text processor/templates

`Hola` // Hola

Assign the output to a variable:

name = "Sara";
text = `Hola, {name}`; // Hola Sara

Coding:

name = "Sara";
text = `Hola, {name += " V."; name}`; // Hola Sara V.

variables:

name = "Sara";
`Hola, {name}` // Hola Sara

if/else statements:

name = "Sara";
useName = true;
`
  Hola
  {if useName:}
    , {name}
  {else:}
    !
  {/if}
`

While loops:

i = 0;
`
  {while i < 5:}
    {i}
    {i = i + 1}
  {/while}
`

Standard functions

contains
isNaN

// String:
length
split
join
upperCase
lowerCase
trim

// Math:
abs
ceil
floor
round
trunc
max
min
fixed

// Types:
isNumber
isDecimal
isInteger
isString
isBoolean
isObject
isArray
help
log
print
hi

Pending

  • Regular expressions
  • break and continue

Objects

k = "key1";
obj = {
  {k}: 1,
  {"key2"}: 2
};

References and special thanks

License

Quara © 2024 by Bernardo Alemán Siverio (wandeber) is licensed under CC BY-ND 4.0