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

barbe

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

barbe - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

.travis.yml

10

example/index.js

@@ -20,1 +20,11 @@ // Require barbe

}));
// Use a function instead of a string
console.log(Barbe("Hello {{worlds.pluto}} from {{worlds.earth}}!", ["{{", "}}"], {
worlds: {
pluto: function () {
return "Pluto";
}
, earth: "Earth"
}
}));

21

lib/index.js

@@ -27,6 +27,21 @@ // Dependencies

Object.keys(data).forEach(function (c) {
text = text.replace(new RegExp(arr[0] + c + arr[1], "g"), data[c]);
});
var value = null
, splits = []
, i = 0
;
function deep(obj, path) {
Object.keys(obj).forEach(function (c) {
value = obj[c];
path.push(c);
if (typeof value === "object") {
return deep(value, path);
}
text = text.replace(new RegExp(arr[0] + path.join(".") + arr[1], "g"), value);
path.pop();
});
}
deep(data, []);
return text;

@@ -33,0 +48,0 @@ }

24

package.json
{
"name": "barbe",
"version": "1.0.0",
"version": "1.1.0",
"description": "Like mustache, but simple, tiny and fast.",
"main": "lib/index.js",
"directories": {
"example": "example"
"example": "example",
"test": "test"
},
"dependencies": {
"regex-escape": "^1.0.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha test"
},

@@ -31,3 +28,12 @@ "repository": {

},
"homepage": "https://github.com/IonicaBizau/barbe"
}
"homepage": "https://github.com/IonicaBizau/barbe",
"dependencies": {
"regex-escape": "^1.0.0"
},
"devDependencies": {
"mocha": "^2.2.5"
},
"blah": {
"h_img": "http://i.imgur.com/tcg2ZNt.png"
}
}

@@ -1,4 +0,20 @@

![](http://i.imgur.com/tcg2ZNt.png)
<!---------------------------------------------------------------------------->
<!-- STOP, LOOK & LISTEN! -->
<!-- ==================== -->
<!-- Do NOT edit this file directly since it's generated from a template -->
<!-- file, using https://github.com/IonicaBizau/node-blah -->
<!-- -->
<!-- If you found a typo in documentation, fix it in the source files -->
<!-- (`lib/*.js`) and make a pull request. -->
<!-- -->
<!-- If you have any other ideas, open an issue. -->
<!-- -->
<!-- Please consider reading the contribution steps (CONTRIBUTING.md). -->
<!-- * * * Thanks! * * * -->
<!---------------------------------------------------------------------------->
# barbe
![barbe](http://i.imgur.com/tcg2ZNt.png)
# barbe [![Donate now][donate-now]][paypal-donations]
Like mustache, but simple, tiny and fast.

@@ -9,3 +25,3 @@

```sh
$ npm install barbe
$ npm i barbe
```

@@ -35,5 +51,17 @@

}));
// Use a function instead of a string
console.log(Barbe("Hello {{worlds.pluto}} from {{worlds.earth}}!", ["{{", "}}"], {
worlds: {
pluto: function () {
return "Pluto";
}
, earth: "Earth"
}
}));
```
## Documentation
### `Barbe(text, arr, data)`

@@ -44,3 +72,3 @@ Renders the input template including the data.

- **String** `text`: The template text.
- **Array** `arr`: An array of two elements: the first one being the start snippet (default: `"{"`) and the second one being the end snippet (default: `"}"`).
- **Array** `arr`: An array of two elements: the first one being the start snippet (default: `&#34;{&#34;`) and the second one being the end snippet (default: `&#34;}&#34;`).
- **Object** `data`: The template data.

@@ -52,12 +80,13 @@

## How to contribute
1. File an issue in the repository, using the bug tracker, describing the
contribution you'd like to make. This will help us to get you started on the
right foot.
2. Fork the project in your account and create a new branch:
`your-great-feature`.
3. Commit your changes in that branch.
4. Open a pull request, and reference the initial issue in the pull request
message.
Have an idea? Found a bug? See [how to contribute][contributing].
## License
See the [LICENSE](./LICENSE) file.
[KINDLY][license] © [Ionică Bizău][website]–The [LICENSE](/LICENSE) file contains
a copy of the license.
[license]: http://ionicabizau.github.io/kindly-license/?author=Ionic%C4%83%20Biz%C4%83u%20%3Cbizauionica@gmail.com%3E&year=2015
[contributing]: /CONTRIBUTING.md
[website]: http://ionicabizau.net
[docs]: /DOCUMENTATION.md
[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MG98D7NPFZ3MG
[donate-now]: http://i.imgur.com/jioicaN.png

Sorry, the diff of this file is not supported yet

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