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

block

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

block - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

.travis.yml

23

index.js

@@ -12,23 +12,22 @@ var regex = /(\{\{\s*\w+\s*\}\})/

for (var i = 0, l = blocks.length; i < l; i++) {
var block = blocks[i]
if (regex.test(block)) {
var block
for (var i = 0, l = blocks.length; i < l; i++)
if (regex.test(block = blocks[i]))
names[i] = block.match(/(\w+)/)[0]
blocks[i] = null
}
}
}
Block.prototype.render = function (locals) {
locals = locals || {}
var blocks = this.blocks
var names = this.names
var l = blocks.length
var buf = new Array(l)
var html = ''
var name
for (var i = 0; i < l; i++)
buf[i] = (name = names[i]) ? locals[name] : blocks[i]
for (var i = 0, l = blocks.length; i < l; i++)
html += (name = names[i]) ? locals[name] : blocks[i]
return buf.join('')
return html
}

@@ -44,2 +43,2 @@

}
} catch (err) {}
} catch (err) {}
{
"name": "block",
"description": "Block-based HTML templating",
"version": "0.0.1",
"version": "0.0.2",
"devDependencies": {

@@ -6,0 +6,0 @@ "mocha": "*",

@@ -1,2 +0,2 @@

# Block.js
# Block.js [![Build Status](https://travis-ci.org/funraiseme/block.png)](https://travis-ci.org/funraiseme/block)

@@ -17,2 +17,10 @@ Ridiculously simple HTML templating. All it does is replaces "blocks" in your template with a local.

yields:
```html
<div class="container">
<div class="inner"></div>
</div>
```
That's it. HTML templating doesn't have to be any harder.

@@ -47,3 +55,3 @@

```js
var template = block.read(__dirname + '/template.html')
var template = block.read(__dirname + '/template.html', false)
template.render({

@@ -54,3 +62,3 @@ content: ''

All `minfy` does, if `true`, is `block = block.replace(/\n\s*/, '')`.
All `minify` does, if `true`, is `html = html.replace(/\n\s*/, '')`.

@@ -57,0 +65,0 @@ ## License

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