summaryrefslogtreecommitdiff
path: root/lib/letter-avatars.js
diff options
context:
space:
mode:
authorBoHong Li2017-03-08 18:45:51 +0800
committerBoHong Li2017-03-08 18:45:51 +0800
commit4889e9732d2458d60e2a079d3e54e128f6ce1b53 (patch)
tree7c867068ca17d7545ebbe10910d95abe3d19f1f9 /lib/letter-avatars.js
parent8f1c97f4a476ff6534ff1e809ed748cf92ba9288 (diff)
Use JavaScript Standard Style
Introduce JavaScript Standard Style as project style rule, and fixed all fail on backend code.
Diffstat (limited to 'lib/letter-avatars.js')
-rw-r--r--lib/letter-avatars.js38
1 files changed, 18 insertions, 20 deletions
diff --git a/lib/letter-avatars.js b/lib/letter-avatars.js
index 3afa03fe..92bd36ee 100644
--- a/lib/letter-avatars.js
+++ b/lib/letter-avatars.js
@@ -1,25 +1,23 @@
-"use strict";
-
// external modules
-var randomcolor = require('randomcolor');
+var randomcolor = require('randomcolor')
// core
-module.exports = function(name) {
- var color = randomcolor({
- seed: name,
- luminosity: 'dark'
- });
- var letter = name.substring(0, 1).toUpperCase();
+module.exports = function (name) {
+ var color = randomcolor({
+ seed: name,
+ luminosity: 'dark'
+ })
+ var letter = name.substring(0, 1).toUpperCase()
- var svg = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>';
- svg += '<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="96" width="96" version="1.1" viewBox="0 0 96 96">';
- svg += '<g>';
- svg += '<rect width="96" height="96" fill="' + color + '" />';
- svg += '<text font-size="64px" font-family="sans-serif" text-anchor="middle" fill="#ffffff">';
- svg += '<tspan x="48" y="72" stroke-width=".26458px" fill="#ffffff">' + letter + '</tspan>';
- svg += '</text>';
- svg += '</g>';
- svg += '</svg>';
+ var svg = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>'
+ svg += '<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="96" width="96" version="1.1" viewBox="0 0 96 96">'
+ svg += '<g>'
+ svg += '<rect width="96" height="96" fill="' + color + '" />'
+ svg += '<text font-size="64px" font-family="sans-serif" text-anchor="middle" fill="#ffffff">'
+ svg += '<tspan x="48" y="72" stroke-width=".26458px" fill="#ffffff">' + letter + '</tspan>'
+ svg += '</text>'
+ svg += '</g>'
+ svg += '</svg>'
- return 'data:image/svg+xml;base64,' + new Buffer(svg).toString('base64');
-};
+ return 'data:image/svg+xml;base64,' + new Buffer(svg).toString('base64')
+}