Socket
Socket
Sign inDemoInstall

os-fonts

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

os-fonts - npm Package Compare versions

Comparing version 0.3.2 to 0.4.0

1

__mocks__/recursive-readdir.js

@@ -20,3 +20,2 @@ let mockFiles = [];

*/
// eslint-disable-next-line no-underscore-dangle
recursiveReaddir.__setFiles = (files) => {

@@ -23,0 +22,0 @@ mockFiles = files;

64

index.js

@@ -6,26 +6,26 @@ const recursive = require('recursive-readdir');

if (process.platform !== 'win32') {
process.env.WINDIR = '';
process.env.WINDIR = '';
}
const FONT_DIRS = {
// https://support.apple.com/en-us/HT201722
// https://discussions.apple.com/thread/6866858?start=0&tstart=0
darwin: {
user: path.join(os.homedir(), 'Library', 'Fonts'),
local: path.join('/', 'Library', 'Fonts'),
network: path.join('/', 'Network', 'Library', 'Fonts'),
system: path.join('/', 'System', 'Library', 'Fonts'),
},
win32: {
user: path.join(process.env.WINDIR, 'Fonts'),
local: path.join(process.env.WINDIR, 'Fonts'),
network: path.join(process.env.WINDIR, 'Fonts'),
system: path.join(process.env.WINDIR, 'Fonts'),
},
linux: {
user: path.join(os.homedir(), 'share', 'fonts'),
local: path.join(os.homedir(), '.local', 'share', 'fonts'),
network: path.join('/', 'usr', 'share', 'fonts'),
system: path.join('/', 'usr', 'share', 'fonts'),
},
// https://support.apple.com/en-us/HT201722
// https://discussions.apple.com/thread/6866858?start=0&tstart=0
darwin: {
user: path.join(os.homedir(), 'Library', 'Fonts'),
local: path.join('/', 'Library', 'Fonts'),
network: path.join('/', 'Network', 'Library', 'Fonts'),
system: path.join('/', 'System', 'Library', 'Fonts'),
},
win32: {
user: path.join(process.env.WINDIR, 'Fonts'),
local: path.join(process.env.WINDIR, 'Fonts'),
network: path.join(process.env.WINDIR, 'Fonts'),
system: path.join(process.env.WINDIR, 'Fonts'),
},
linux: {
user: path.join(os.homedir(), 'share', 'fonts'),
local: path.join(os.homedir(), '.local', 'share', 'fonts'),
network: path.join('/', 'usr', 'share', 'fonts'),
system: path.join('/', 'usr', 'share', 'fonts'),
},
};

@@ -39,11 +39,12 @@

*/
exports.getFontsInDirectory = dir => new Promise((resolve) => {
recursive(dir, (err, files) => {
if (err) {
resolve([]);
return;
}
resolve(files);
});
});
exports.getFontsInDirectory = dir =>
new Promise(resolve => {
recursive(dir, (err, files) => {
if (err) {
resolve([]);
return;
}
resolve(files);
});
});

@@ -56,2 +57,3 @@ /**

*/
exports.getAll = (useType = 'system') => exports.getFontsInDirectory(FONT_DIRS[process.platform][useType]);
exports.getAll = (useType = 'system') =>
exports.getFontsInDirectory(FONT_DIRS[process.platform][useType]);
{
"name": "os-fonts",
"description": "Retrieve fonts available on your OS.",
"version": "0.3.2",
"version": "0.4.0",
"author": "Vu Tran <vu@vu-tran.com>",

@@ -15,7 +15,5 @@ "dependencies": {

"coveralls": "^2.11.14",
"eslint": "^3.9.0",
"eslint-config-airbnb-base": "^9.0.0",
"eslint-plugin-async": "^0.1.1",
"eslint-plugin-import": "^2.0.1",
"jest": "^16.0.2"
"husky": "^0.13.3",
"jest": "^16.0.2",
"prettier": "^1.2.2"
},

@@ -35,5 +33,6 @@ "keywords": [

"scripts": {
"lint": "eslint index.js __tests",
"lint": "prettier --single-quote --trailing-comma=es5 --print-width=90 --tab-width=4 --write '{__{mocks,test}__/*.js' 'index.js'",
"precommit": "npm run lint",
"test": "jest --coverage"
}
}
# os-fonts
[![Travis](https://img.shields.io/travis/vutran/os-fonts/develop.svg?maxAge=2592000&style=flat-square)](https://travis-ci.org/vutran/os-fonts) [![Coveralls branch](https://img.shields.io/coveralls/vutran/os-fonts/develop.svg?maxAge=2592000&style=flat-square)](https://coveralls.io/github/vutran/os-fonts) [![license](https://img.shields.io/github/license/vutran/os-fonts.svg?maxAge=2592000&style=flat-square)](LICENSE)
[![Travis](https://img.shields.io/travis/vutran/os-fonts/master.svg?maxAge=2592000&style=flat-square)](https://travis-ci.org/vutran/os-fonts) [![Coveralls branch](https://img.shields.io/coveralls/vutran/os-fonts/master.svg?maxAge=2592000&style=flat-square)](https://coveralls.io/github/vutran/os-fonts) [![license](https://img.shields.io/github/license/vutran/os-fonts.svg?maxAge=2592000&style=flat-square)](LICENSE)

@@ -5,0 +5,0 @@ > Retrieve fonts available on your OS.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc