Skip to content

Commit

Permalink
add license comment
Browse files Browse the repository at this point in the history
  • Loading branch information
broud committed Apr 4, 2014
1 parent 8a50fac commit 27f1801
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
npm-debug.log
.idea
coverage
.DS_Store
26 changes: 17 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@ Appendit allows you easily to add text at a specific line. It will works with an

## Installation

```npm install --save appendit```
```bash
npm install appendit
```

# Example
## Example

Below a quick example how to use appendit:


The ```index.html``` looks like that:

```
```html
<html>
<head>
<title></title>
Expand All @@ -25,7 +27,7 @@ The ```index.html``` looks like that:
```
Call the ```appendit``` function with the following parameters:

```
```js
var fs = require('fs');
var appendit = require('appendit');

Expand All @@ -42,7 +44,7 @@ fs.writeFileSync('index.html', content);

Output:

```
```html
<html>
<head>
<title></title>
Expand All @@ -58,7 +60,7 @@ Output:

Let's add a headline to the body:

```
```js
appendit({
source: fs.readFileSync('index.html', 'utf8'),
anchor: '</body>',
Expand All @@ -70,7 +72,7 @@ appendit({

Output:

```
```html
<html>
<head>
<title></title>
Expand All @@ -83,5 +85,11 @@ Output:
</html>
```

# Testing
Running ```npm test```will run the unit tests with mocha
## Testing
Running ```npm test``` will run the unit tests with mocha.

## License

This program contains source code from the [Yeoman](https://github.com/yeoman) Project, released under the BSD.

[BSD license](http://opensource.org/licenses/bsd-license.php)
9 changes: 6 additions & 3 deletions lib/appendit.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@

// This file contains source code from the Yeoman Project, released under the BSD.
// License: http://opensource.org/licenses/bsd-license.php
// Yeoman: https://github.com/yeoman

'use strict';

var _ = require('lodash');
Expand All @@ -19,15 +24,13 @@ module.exports = function (options) {

if (options.check === undefined) options.check = true;
if (options.insertAfter === undefined) options.insertAfter = false;
if (options.useParentSpace === undefined) options.useParentSpace = false;
if (options.matchIndex === undefined || options.matchIndex === 'last') options.matchIndex = -1;
if (options.matchIndex === 'first') options.matchIndex = 0;

return rewrite(options);
};

// The following code contains logic from the generator-backbone.
// https://github.com/yeoman/generator-backbone/blob/master/util.js
// The following code was developed by the yeoman team.

function escapeRegExp(str) {
return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"description": "",
"homepage": "https://github.com/stefanbuck/appendit",
"bugs": "https://github.com/stefanbuck/appendit/issues",
"license": "MIT",
"license": "BSD",
"author": {
"name": "Stefan Buck",
"email": "git@stefanbuck.com",
Expand Down

0 comments on commit 27f1801

Please sign in to comment.