New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

jeyson

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jeyson - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

package.json
{
"name": "jeyson",
"version": "1.0.1",
"version": "1.0.2",
"description": "Json template engine",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

@@ -1,15 +0,15 @@

## JSO-NG
- JSO-NG is a templating language for serving json content.
- It extends the notion of compiling html templates to json.
## Jeyson Templates
- Every json is a valid template in itself.
- The templates can have expressions, which can execute javascript.
- These templates are compiled in context of a scope.
- The templates can have expressions, which can manipulate scope and execute javascript.
- Directives can pass instructions to compiler.
- Inbuilt directives for repeating, including other json etc.
- Custom directives can replace/modify template body, execute expressions, read other templates.
### Compiling Templates
```javascript
var jsong = require('jso-ng').create(),
var jeyson = require('jeyson').create(),
scope = {message: 'Hello!'},
templateJson = '{"message": "{{message}}"}',
compiled = compiler.compile(scope , templateJson);
compiled = jeyson.parse(scope, templateJson);
```

@@ -33,3 +33,3 @@

### Javascript as expression.
### Javascript in Expressions.
Any valid javascript snippet is a valid expression, e.g following __template.json__ :

@@ -91,4 +91,5 @@ ```javascript

### Directives
- Directive as a name starting with __"@"__
- Directive body is any field in json with child field's name starting with __"@"__'
- Directive is a field with name starting with __"@"__
- Directive __body__ is the parent subtree of directive field
- Directive argument is the value of directive field.

@@ -100,3 +101,3 @@ E.g.

"@repeat" : "name in ['one','two','three','four','five']",
"id" : "{{$index}}",
"id" : "{{$index + 1}}",
"name" : "{{name}}",

@@ -124,8 +125,17 @@ }

### Inbuilt Directives
Inbuilt directives for repeating, including other json etc.
### @repeat
- $index
- array
- result
### Custom Directives
- Modifying
- Modifying
- Replacing directive contents
- Source code of inbuilt directives
- Reading scope
- Executing expressions
- Modifying body
- Replacing body
- Reading other templates by relative path
### Source code of inbuilt directives

@@ -135,1 +145,2 @@

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