Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ var myApp = angular.module('myApp', ['truncate']);
###When outputting text, apply the filter.
```html
<p>
{{ text | characters:25 }} or {{ text | words:5 }}
{{ text | characters:25 }} or {{ text | splitcharacters:5 }} or {{ text | words:5 }}
</p>
```

Expand All @@ -32,4 +32,4 @@ By default, a _word_ will not be truncated. Set the optional boolean after the c
<p>
{{ text | characters:25 :true}}
</p>
```
```
2 changes: 1 addition & 1 deletion src/truncate.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ angular.module('truncate', [])
if (input && input.length > chars) {
var prefix = input.substring(0, chars/2);
var postfix = input.substring(input.length-chars/2, input.length);
return prefix + '...' + postfix;
return prefix + '' + postfix;
}
return input;
};
Expand Down
4 changes: 2 additions & 2 deletions test/unit/filtersSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ describe('truncate', function () {
});

it('should trim these down', function () {
expect(characterFilter('1234567890', 5)).toEqual('12...890');
expect(characterFilter('1234567890', 5)).toEqual('12890');
});

it('should trim this down including the space', function () {
expect(characterFilter('123456789 10 11 12 13 14', 13)).toEqual('123456...2 13 14');
expect(characterFilter('123456789 10 11 12 13 14', 13)).toEqual('1234562 13 14');
});

it('should handle invalid numbers', function () {
Expand Down