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.1.2 to 0.2.0

2

component.json
{
"name": "block",
"description": "Block-based HTML templating",
"version": "0.1.2",
"version": "0.2.0",
"scripts": [

@@ -6,0 +6,0 @@ "index.js"

@@ -29,23 +29,12 @@ module.exports = Block

Block.prototype.render = function (locals) {
if (typeof locals === 'object') {
var string = this.string
Object.keys(locals).forEach(function (key) {
string = replace(string, key, locals[key])
})
return string
}
if (!locals)
return this.string
return this.string
var string = this.string
Object.keys(locals).forEach(function (key) {
string = replace(string, key, locals[key])
})
return string
}
// Node only!
try {
var fs = require('fs')
Block.read = function (filename, minify) {
var string = fs.readFileSync(filename, 'utf8')
return new Block(minify ? string.replace(/\n\s*/g, '') : string)
}
} catch (err) {}
function replace(string, key, value) {

@@ -52,0 +41,0 @@ return string.replace(

{
"name": "block",
"description": "Block-based HTML templating",
"version": "0.1.2",
"version": "0.2.0",
"devDependencies": {

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

@@ -49,15 +49,2 @@ # Block.js [![Build Status](https://travis-ci.org/funraiseme/block.png)](https://travis-ci.org/funraiseme/block)

### Block.read(file, minify)
This is for nodejs only. `file` is the name of the file, `minify` strips whitespace.
```js
var template = block.read(__dirname + '/template.html', false)
template.render({
content: ''
})
```
All `minify` does, if `true`, is `html = html.replace(/\n\s*/, '')`.
## License

@@ -64,0 +51,0 @@

Sorry, the diff of this file is not supported yet

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