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

eztl

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eztl - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

lib/index.js

29

lib/render.js

@@ -10,8 +10,2 @@ 'use strict';

var _parse = require('./parse');
var _parse2 = _interopRequireDefault(_parse);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function render(parts) {

@@ -33,7 +27,8 @@ var variables = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];

} else if (type === _constants.STRING_VARIABLE) {
if (varValue === undefined) throwStringUndefined(name);
if (varValue === undefined) throwStringReferenceError(name);
if (typeof varValue !== 'string') throwStringTypeError(name);
results.push(varValue);
} else if (type === _constants.IF_CONTROL) {
if (varValue === undefined) throwBooleanUndefined(name);
if (varValue !== true && varValue !== false) throwBooleanWrongType(name);
if (varValue === undefined) throwBooleanReferenceError(name);
if (varValue !== true && varValue !== false) throwBooleanTypeError(name);

@@ -86,12 +81,16 @@ var ifIndex = i;

function throwStringUndefined(name) {
throw new Error('String variable "' + name + '" is undefined.');
function throwStringReferenceError(name) {
throw new ReferenceError('String variable "' + name + '" is undefined.');
}
function throwBooleanUndefined(name) {
throw new Error('Boolean variable "' + name + '" is undefined.');
function throwBooleanReferenceError(name) {
throw new ReferenceError('Boolean variable "' + name + '" is undefined.');
}
function throwBooleanWrongType(name) {
throw new Error('Boolean variable "' + name + '" is not a Boolean.');
function throwStringTypeError(name) {
throw new TypeError('String variable "' + name + '" is not a String.');
}
function throwBooleanTypeError(name) {
throw new TypeError('Boolean variable "' + name + '" is not a Boolean.');
}
{
"name": "eztl",
"version": "0.0.1",
"version": "0.1.0",
"description": "ez template language",
"author": "Scott Hardy <scott.the.hardy@gmail.com> (https://www.scotthardy.me)",
"main": "lib/transform.js",
"main": "lib/index.js",
"license": "MIT",

@@ -11,7 +11,5 @@ "repository": "https://github.com/scott113341/eztl.git",

"bugs": "https://github.com/scott113341/eztl/issues",
"preferGlobal": true,
"files": [
"lib/"
],
"bin": "lib/cli.js",
"scripts": {

@@ -18,0 +16,0 @@ "prebuild": "rm -rf lib/ && mkdir -p lib/",

@@ -1,1 +0,31 @@

# eztl
# eztl – ez template language
[![npm-version][npm-version-badge]][npm-version-href]
[![build-status][build-status-badge]][build-status-href]
[![dependencies][dependencies-badge]][dependencies-href]
[![dev-dependencies][dev-dependencies-badge]][dev-dependencies-href]
## example
```javascript
import eztl from 'eztl';
const input = 'Hello, {% location %}{% shout? %}!{% else %}.{% end %}';
const variables = { location: 'world', 'shout?': false };
const output = eztl(input, variables);
console.log(output); // "Hello, world."
```
[npm-version-badge]: https://img.shields.io/npm/v/eztl.svg?label=version&style=flat-square
[npm-version-href]: https://www.npmjs.com/package/eztl
[build-status-badge]: https://img.shields.io/travis/scott113341/eztl.svg?style=flat-square
[build-status-href]: https://travis-ci.org/scott113341/eztl
[dependencies-badge]: https://img.shields.io/david/scott113341/eztl.svg?style=flat-square
[dependencies-href]: https://david-dm.org/scott113341/eztl#info=dependencies
[dev-dependencies-badge]: https://img.shields.io/david/dev/scott113341/eztl.svg?style=flat-square
[dev-dependencies-href]: https://david-dm.org/scott113341/eztl#info=devDependencies
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