New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

openbadge

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openbadge - npm Package Compare versions

Comparing version

to
1.0.2

assets/example.png

15

badges/baseBadge.js

@@ -12,11 +12,7 @@ /**

box1 = box(text[0], {
font: options.font
});
box1 = box(text[0], options);
//The second box
box2 = box(text[1], {
font: options.font,
offsetX: box1.width
});
// The second box needs to be drawn a bit to the right.
options.offsetX = box1.width;
box2 = box(text[1], options);

@@ -32,4 +28,5 @@ width = box1.width + box2.width;

text1: box1.textPath,
text2: box2.textPath
text2: box2.textPath,
color: options.color
});
};

13

index.js

@@ -19,3 +19,12 @@ /**

fontSize: '11'
}
},
color: {
left: '#555',
right: '#4c1',
font: '#fff',
shadow: '#010101'
},
paddingX: 6,
paddingY: 6,
offsetX: 0
};

@@ -34,3 +43,3 @@ defaultOptions = _.merge(defaultOptions, options);

defaultOptions.font.loadedFont = loadedFont;
res = badge(defaultOptions.text, {font: defaultOptions.font});
res = badge(defaultOptions.text, defaultOptions);
return callback(null, res);

@@ -37,0 +46,0 @@ }

@@ -5,2 +5,8 @@ /**

/**
* Helper function factory to determine the scaling factor of a font.
* @param unitsPerEM This number comes from the font file itself. It specifies the conversion of the font-face units into EM. (ie: the resolution of the font)
* @param pixelsPerEM This number is contextual, and is basically the font size.
* @returns {unitToPixels} a pre-baked helper function that converts font units to pixels at a given font size.
*/
function calculator(unitsPerEM, pixelsPerEM) {

@@ -13,8 +19,15 @@ var scaleFactor = pixelsPerEM / unitsPerEM;

module.exports = function (message, options) {
/**
* Given a font face, and all the desired parameters for this badge fragment, determine how tall and wide it should be,
* as well as the paths for drawing the text.
* @param message The text to render on this badge fragment
* @param options Padding, Offset, Font and attributes.
* @returns {{width: *, height: *, textPath: (XML|string|void)}} The bounding box for this fragment, with the rendered text centered vertically and horizontally
*/
module.exports = function getBoundingBox(message, options) {
var font = options.font.loadedFont,
offsetX = options.offsetX || 0, // It's all horizontal, so no need for offsetY
paddingX = options.paddingX || 6,
paddingY = options.paddingY || 6,
fontSize = options.font.fontSize || 11,
offsetX = options.offsetX, // It's all horizontal, so no need for offsetY
paddingX = options.paddingX,
paddingY = options.paddingY,
fontSize = options.font.fontSize,
heightInUnits, widthInUnits,

@@ -21,0 +34,0 @@ heightInPixels, widthInPixels,

{
"name": "openbadge",
"version": "1.0.1",
"version": "1.0.2",
"description": "Create SVG badges for your github projects",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified ...yet...\" && exit 1"
},
"author": "@lennymarkus",
"license": "ISC",
"license": "Apache-2.0",
"dependencies": {
"lodash": "^3.10.1",
"opentype.js": "^0.6.0"
}
},
"devDependencies": {},
"repository": {
"type": "git",
"url": "git+https://github.com/lmarkus/openBadge.git"
},
"keywords": [
"shield.io",
"fury.io",
"badge",
"github",
"shield",
"svg"
],
"bugs": {
"url": "https://github.com/lmarkus/openBadge/issues"
},
"homepage": "https://github.com/lmarkus/openBadge#readme"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet