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

ltl

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ltl - npm Package Compare versions

Comparing version 0.1.14 to 0.1.15

39

ltl.js

@@ -15,2 +15,5 @@ /**

// Pattern for a JavaScript assignment.
var assignmentPattern = /^([$A-Za-z_][$A-Za-z_0-9\.\[\]'"]*\s*=[^\{])/;
// Supported command keywords.

@@ -21,3 +24,3 @@ var commandPattern = /^(call|get|set)\b/;

// TODO: Flesh out this list?
var jsPattern = /^(true|false|null|NaN|Infinity|window|location|Math|console)$/;
var jsPattern = /^(true|false|null|NaN|Infinity|window|location|Math|console|this)$/;

@@ -73,3 +76,3 @@ // Stores available single character variable names.

// Allow users to see what version of ltl they're using.
version: '0.1.14',
version: '0.1.15',

@@ -111,2 +114,3 @@ // Store all of the templates that have been compiled.

}
var getPattern = new RegExp(settings.contextVar + '\\.get\\.([$A-Za-z_][$A-Za-z_\d]*)', 'ig');

@@ -172,6 +176,9 @@ // Don't allow context/output/parts vars to become user vars.

function startBlock(filter) {
function startBlock(filter, line) {
blockIndent = indent + 1;
blockFilter = filter;
blockLines = [];
if (line) {
blockLines.push(line);
}
}

@@ -306,3 +313,3 @@

script = script.replace(/^(for)\s+([$a-zA-Z_][$a-zA-Z_0-9]*)\s+in\s+([$a-zA-Z_][$a-zA-Z_0-9]*)\s*$/i,
script = script.replace(/^(for)\s+([$A-Za-z_][$A-Za-z_\d]*)\s+in\s+([$A-Za-z_][$A-Za-z_\d\.]*)\s*$/,
function(match, keyword, item, array) {

@@ -323,3 +330,3 @@ found = true;

script = script.replace(/^(for)\s+([$a-zA-Z_][$a-zA-Z_0-9]*)\s*,\s*([$a-zA-Z_][$a-zA-Z_0-9]*)\s+of\s+([$a-zA-Z_][$a-zA-Z_0-9]*)\s*$/i,
script = script.replace(/^(for)\s+([$A-Za-z_][$A-Za-z_\d]*)\s*,\s*([$A-Za-z_][$A-Za-z_\d]*)\s+of\s+([$A-Za-z_][$A-Za-z_\d\.]*)\s*$/,
function(match, keyword, key, value, object) {

@@ -385,3 +392,9 @@ found = true;

}
return tokens.join('');
code = tokens.join('');
getPattern = /c\.get\.([$A-Za-z_][$A-Za-z_\d]*)/g;
code = code.replace(getPattern, function (match, part) {
hasGets = true;
return settings.partsVar + "['" + part + "'].call(this," + settings.contextVar + ")";
});
return code;
}

@@ -424,2 +437,3 @@

var hasGets = false;
var hasAssignments = false;
var inComment = false;

@@ -479,2 +493,9 @@

// Assignment patterns just need to be contextified.
else if (assignmentPattern.test(line)) {
hasAssignments = true;
line = contextify(line) + ';';
appendText('script', line);
}
// Expression patterns make things append.

@@ -485,2 +506,3 @@ else if (commandPattern.test(line)) {

blockName = pair[1];
var content = pair[2];
pair = blockName.split(':');

@@ -496,3 +518,3 @@ blockName = pair[0];

}
startBlock(command);
startBlock(command, content);
}

@@ -724,2 +746,5 @@ }

}
if (hasAssignments) {
output = settings.contextVar + '=' + settings.contextVar + '||{};' + output;
}
output = 'function(' + settings.contextVar + (hasGets ? ',' + settings.partsVar : '') + '){' + output + '}';

@@ -726,0 +751,0 @@

22

MIT-LICENSE.md

@@ -1,21 +0,1 @@

The MIT License (MIT)
Copyright (c) 2014 Sam Eubank
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
undefined
{
"name": "ltl",
"version": "0.1.15",
"description": "Lean Template Language for JavaScript and HTML",
"dependencies": {},
"devDependencies": {
"coffee-script": "1.8.0",
"coveralls": "2.11.1",
"dot": "1.0.2",
"exam": "^0.0.7",
"istanbul": "0.3.1",
"jade": "1.6.0",
"markdown": "0.5.0",
"marked": "0.3.2",
"zeriousify": "^0.1.10"
},
"keywords": [

@@ -14,17 +27,8 @@ "lean",

],
"version": "0.1.14",
"main": "ltl",
"homepage": "http://lighter.io/ltl",
"repository": "git://github.com/lighterio/ltl.git",
"author": "Sam Eubank <sameubank@gmail.com>",
"contributors": [
"Sam Eubank <sameubank@gmail.com>",
"Kaushik Shankar <skaushik92@gmail.com>"
],
"engines": [
"node >= 0.2.6"
],
"engines": {
"node": ">=0.2.6"
},
"scripts": {
"test": "./node_modules/exam/exam.js",
"retest": "./node_modules/exam/exam.js --watch",
"cover": "istanbul cover ./node_modules/exam/exam.js",

@@ -35,23 +39,11 @@ "report": "open coverage/lcov-report/index.html",

},
"dependencies": {},
"devDependencies": {
"coffee-script": "1.8.0",
"coveralls": "2.11.1",
"dot": "1.0.2",
"exam": "0.0.7",
"istanbul": "0.3.1",
"jade": "1.6.0",
"markdown": "0.5.0",
"marked": "0.3.2",
"zeriousify": "0.1.9"
},
"bugs": {
"url": "http://github.com/lighterio/ltl/issues"
},
"licenses": [
{
"type": "MIT",
"url": "http://github.com/lighterio/ltl/blob/master/MIT-LICENSE.md"
}
]
"repository": "https://github.com/lighterio/ltl.git",
"bugs": "https://github.com/lighterio/ltl/issues",
"homepage": "http://lighter.io/ltl",
"author": "Sam Eubank <sameubank@gmail.com>",
"contributors": [
"Sam Eubank <sameubank@gmail.com>",
"Kaushik Shankar <skaushik92@gmail.com>"
],
"license": "MIT"
}

@@ -17,8 +17,8 @@ # Ltl

Install
Add Ltl to your project.
```bash
$ npm install ltl
$ npm install --save ltl
```
Use
Compile and render templates.
```javascript

@@ -33,3 +33,3 @@ var ltl = require('ltl');

### ltl.compile(code, [options])
* `code` is a string of ltl code.
* `code` is a string of Ltl code.
* `options` is an object with any of the following properties:

@@ -43,7 +43,7 @@ * `name` will cause the template to cache at `ltl.templates[name]`

The following compiler options are available:
* `outputVar` is the name of the variable that Ltl concatenates to. (Default: "o")
* `contextVar` is the name of the argument that passes context into a template. (Default: "c")
* `partsVar` is the name of the argument that a Ltl template receives from callers. (Default: "p")
* `tabWidth` is the number of spaces that tabs are converted to before compilation. (Default: 4)
Supported options:
* **outputVar** is the name of the variable that Ltl concatenates to. (Default: "o")
* **contextVar** is the name of the argument that passes context into a template. (Default: "c")
* **partsVar** is the name of the argument that a Ltl template receives from callers. (Default: "p")
* **tabWidth** is the number of spaces that tabs are converted to before compilation. (Default: 4)

@@ -119,3 +119,3 @@ ## Language

```
Note: Unlike Jade, ltl does not use commas between attributes.
**Note:** Unlike Jade, Ltl does not use commas between attributes.

@@ -138,3 +138,3 @@ ### Untagged Lines

You can output blocks of content using `:`.
You can output blocks of content as plain text, using `:`.
```jade

@@ -152,3 +152,3 @@ #blah:

Blocks can be passed through filters, such as markdown.
Blocks can also be passed through filters, such as `markdown`.
```jade

@@ -163,2 +163,9 @@ :markdown

If a filter is unrecognized, Ltl will attempt to load it in the following ways:
* **Client-side:** use `window['FILTER_NAME']`
* **Server-side:** use `require('FILTER_NAME')`
A filter must have a function named `compile` or `parse` which accepts a context
and returns a string, or it can be such a function itself.
### Comments

@@ -237,5 +244,18 @@

### Variable Assignment
You can assign a value to a variable in the template context using `=`.
```jade
who = 'World'
. Hello ${who}!
```
```html
<p>Hello World!</p>
```
### Control
Use `for..in` to iterate over an array inside the context.
* Context: `{list: ['IPA', 'Porter', 'Stout']}`
*Context:* `{list: ['IPA', 'Porter', 'Stout']}`
```jade

@@ -251,9 +271,10 @@ ul

Use `for..of` to iterate over an object's keys.
*Context:* `{pairings: {Coffee: 'coding', Beer: 'bloviating'}}`
```jade
ul
for field, value of data
li #{field}: #{value}
for drink, activity of pairings
. #{field} is for #{value}.
```
```html
<ul><li>IPA</li><li>Porter</li><li>Stout</li></ul>
<div>Coffee is for coding.</div><div>Beer is for bloviating</div>
```

@@ -260,0 +281,0 @@

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