Skip to content

Commit

Permalink
Use the unicode copyright symbol U+00A9
Browse files Browse the repository at this point in the history
  • Loading branch information
mightyiam committed May 13, 2015
1 parent 65bd167 commit 0cd9c85
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ var merge = require('merge-deep');
*
* ```js
* {%= copyright() %}
* //=> Copyright (c) 2014-2015, Jon Schlinkert.
* //=> Copyright © 2014-2015, Jon Schlinkert.
*
* {%= copyright({year: 2012}) %}
* //=> Copyright (c) 2012-2014 Jon Schlinkert.
* //=> Copyright © 2012-2014 Jon Schlinkert.
* ```
*
* @param {Number} `year` Optionally pass the start year of the project.
Expand Down Expand Up @@ -57,7 +57,7 @@ module.exports = function copyright(locals) {
}

var current = new Date().getFullYear();
var str = 'Copyright (c) ';
var str = 'Copyright © ';

if (ctx.copyright) {
ctx = merge(ctx, ctx.copyright);
Expand Down
20 changes: 10 additions & 10 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,48 +18,48 @@ var locals = {author: {name: 'Jon Schlinkert', url: 'https://github.com/jonschli

describe('helper copyright', function () {
it('should return a formatted copyright statement:', function () {
copyrightHelper(locals).should.eql('Copyright (c) '+ year + ' Jon Schlinkert');
copyrightHelper(locals).should.eql('Copyright © '+ year + ' Jon Schlinkert');
});

it('should update the start year:', function () {
var ctx = {author: {name: 'Jon Schlinkert', url: 'https://github.com/jonschlinkert'}, year: '2013'};
copyrightHelper(ctx).should.eql('Copyright (c) 2013-'+ year + ' Jon Schlinkert');
copyrightHelper(ctx).should.eql('Copyright © 2013-'+ year + ' Jon Schlinkert');
});

it('should update the range of years:', function () {
var ctx = {author: {name: 'Jon Schlinkert', url: 'https://github.com/jonschlinkert'}, years: '2013-2020'};
copyrightHelper(ctx).should.eql('Copyright (c) 2013-2020 Jon Schlinkert');
copyrightHelper(ctx).should.eql('Copyright © 2013-2020 Jon Schlinkert');
});

it('should work as a lodash helper:', function () {
_.template('<%= copyright({author: author}) %>', {imports: {copyright: copyrightHelper}})(locals).should.eql('Copyright (c) ' + year + ' Jon Schlinkert');
_.template('<%= copyright({author: author}) %>', {imports: {copyright: copyrightHelper}})(locals).should.eql('Copyright © ' + year + ' Jon Schlinkert');
});

it('should work as a lodash mixin:', function () {
_.mixin({copyright: copyrightHelper});
_.template('<%= _.copyright({author: author}) %>')(locals).should.eql('Copyright (c) '+ year + ' Jon Schlinkert');
_.template('<%= _.copyright({author: author}) %>')(locals).should.eql('Copyright © '+ year + ' Jon Schlinkert');
});

it('should work as a handlebars helper:', function () {
handlebars.registerHelper('copyright', copyrightHelper);
handlebars.compile('{{copyright this}}')(locals).should.eql('Copyright (c) '+ year + ' Jon Schlinkert');
handlebars.compile('{{copyright this}}')(locals).should.eql('Copyright © '+ year + ' Jon Schlinkert');
});
});

describe('when `linkify` is `true`:', function () {
it('should return a formatted copyright statement:', function () {
locals = _.extend({linkify: true}, locals);
copyrightHelper(locals).should.eql('Copyright (c) ' + year + ' [Jon Schlinkert](https://github.com/jonschlinkert)');
copyrightHelper(locals).should.eql('Copyright © ' + year + ' [Jon Schlinkert](https://github.com/jonschlinkert)');
});

it('should work as a lodash helper:', function () {
_.template('<%= copyright({author: author, linkify: true}) %>', {imports: {copyright: copyrightHelper}})(locals).should.eql('Copyright (c) ' + year + ' [Jon Schlinkert](https://github.com/jonschlinkert)');
_.template('<%= copyright({author: author, linkify: true}) %>', {imports: {copyright: copyrightHelper}})(locals).should.eql('Copyright © ' + year + ' [Jon Schlinkert](https://github.com/jonschlinkert)');
});

it('should work as a handlebars helper:', function () {
locals = _.extend({linkify: true}, locals);
handlebars.registerHelper('copyright', copyrightHelper);

handlebars.compile('{{copyright this}}')(locals).should.eql('Copyright (c) '+ year + ' [Jon Schlinkert](https://github.com/jonschlinkert)');
handlebars.compile('{{copyright this}}')(locals).should.eql('Copyright © '+ year + ' [Jon Schlinkert](https://github.com/jonschlinkert)');
});
});
});

0 comments on commit 0cd9c85

Please # to comment.