Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tplify

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tplify - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

10

dist/view.js

@@ -84,3 +84,6 @@ 'use strict';

value: function _getElementValue(element) {
if (element.nodeName === 'INPUT') return element.value;
if (element.nodeName === 'INPUT') {
if (element.type === 'checkbox' || element.type === 'radio') return element.checked;
return element.value;
}
return element.innerHTML;

@@ -134,3 +137,6 @@ }

if (!element) return;
if (element.nodeName === 'INPUT') element.value = value;else element.innerHTML = value;
if (element.nodeName === 'INPUT') {
if (element.type === 'checkbox' || element.type === 'radio') element.checked = value;
element.value = value;
} else element.innerHTML = value;
}

@@ -137,0 +143,0 @@ }, {

2

package.json
{
"version": "0.0.3",
"version": "0.0.4",
"name": "tplify",

@@ -4,0 +4,0 @@ "description": "A simple html template compiler plugin for Browserify",

# tplify
A Browserify plugin used internally at Timpex AS that allows to `require` html templates.
## Installation
`npm install tplify`
### Add to build
```javascript
browserify({...})
.plugin('tplify')
.bundle();
```
## Usage
### Javascript
```javascript
var view = require('./path/to/view.tpl.html');
view.activate(parentNode);
view.deactivate();
view.setData({data-property: value, ...});
view.getData(); // => {data-property: value, ...}
view.data-name; // => HTMLElement
```
### Template
```html
// available for view.setData({someProperty: value}) and view.getData();
<div data-property="someProperty"></div>
// available as property on view.someName
<div data-name="someName"></div>
```

@@ -59,4 +59,7 @@ export default class View {

_getElementValue(element) {
if (element.nodeName === 'INPUT')
if (element.nodeName === 'INPUT') {
if (element.type === 'checkbox' || element.type === 'radio')
return element.checked;
return element.value;
}
return element.innerHTML;

@@ -104,4 +107,7 @@ }

if (!element) return;
if (element.nodeName === 'INPUT')
if (element.nodeName === 'INPUT') {
if (element.type === 'checkbox' || element.type === 'radio')
element.checked = value;
element.value = value;
}
else

@@ -108,0 +114,0 @@ element.innerHTML = value;

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