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

brown

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brown - npm Package Compare versions

Comparing version 1.1.23 to 1.1.24

Cakefile

6

index.js

@@ -7,6 +7,8 @@ // Generated by CoffeeScript 1.9.3

this.safe_eval = function(str, data) {
var FOO, result;
var FOO, evalstr, result;
str = str.split(':')[0];
result = "";
try {
result = new Function('return ( arguments[0]["' + str + '"] )')(data);
evalstr = (!str.match(/\./) ? '["' + str + '"]' : '.' + str);
result = new Function('return ( arguments[0]' + evalstr + ' )')(data);
} catch (_error) {

@@ -13,0 +15,0 @@ FOO = _error;

{
"name": "brown",
"version": "1.1.23",
"version": "1.1.24",
"description": "Ultra-extendable Mustache-ish template engine on steroids in 620 gzipped kilobytes, need nothing more!",
"main": "index.js",
"scripts": {
"test": "coffee test/test.coffee",
"test": "cake test/test.coffee",
"compile_nocompress": "/bin/bash -c 'browserify -r .:brown > brown.js'",

@@ -9,0 +9,0 @@ "compile": "/bin/bash -c 'browserify -r .:brown | uglifyjs -c > brown.min.js'"

@@ -1,100 +0,1 @@

<h1>ϐrown</h1>
Jade-ish + Mustache-ish template engine on steroids in 846 gzipped kilobytes
# Usage
$ npm install brown
or in the browser:
<script type='text/javascript' src='brown.min.js'></script>
## Simple
brown.render( "hello {{foo.bar}}", {
foo: {
bar: "world"
}
});
outputs:
hello world
## Functions
Create a fullfledged template engine by adding functions:
brown.encode = function(key,type) {
var html = this[key] || '';
return type == "html" ?
String(html).replace(/&/g, '&amp;').replace(/"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;') :
html
};
brown.render( 'a href="{{href}}" onclick="{{encode:label:html}}"': "{{label}}", {
href="/",
label:"my \"label\""}
});
outputs:
<div>
<ul>
<li>
<a href="/" onclick="my &quot;label&quot;">my "label"</a>
</li>
</ul>
</div>
## If / Else / Looping
> Need more? See [brown-ext-basic for if/foreach/filter/loop-functionality](https://www.npmjs.com/package/brown-ext-basic).
## Generate xml/html from jsonportable JADE
ϐrown can be monkeypatched, to automatically produce xml-trees from json (like JADE), see this coffeescript example:
json =
ul:
li: 'a href="{{foo}}": "Click me"
brown.render json,{ foo: "/" }
outputs:
<ul>
<li>
<a href="/">Click me </a>
</li>
</ul>
How?
Simple, by just monkeypatching ϐrown with [json-dsl](https://npmjs.org/package/json-dsl). See [coffeescript](test/jadeish.coffee) / [JS](test/jadeish.js) examples.
## Commandline util
Use as a commandline generator (install using `npm install -g` ) :
$ brown
Usage: brown <string|file> [jsonstring|jsonfile]
examples:
$ brown 'foo {{foo}}' '{"foo":"world"}'
$ brown foo.html data.json
# Goals / Philosophy
* lightweight and extendable
* mustache without the noise and weight (mustache is a whopping 97k and pretty slow)
With ϐrown as a fundament you can literally do anything.
# Extentions & Dependents
* [brown-ext-basic](https://www.npmjs.com/package/brown-ext-basic).
# Roadmap
* stability and peace

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