Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cachedir

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cachedir - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

test.js

48

index.js

@@ -0,34 +1,32 @@

var os = require('os')
var path = require('path')
var os = require('os');
var env = process.env;
function linux (id) {
return path.join(os.homedir(), '.cache', id)
}
var implementation;
switch(os.type()) {
case 'Darwin':
implementation = function (id) {
return env.HOME + '/Library/Caches/' + id;
};
break;
case 'Linux':
implementation = function (id) {
return env.HOME + '/.cache/' + id;
};
break;
default:
throw new Error('Your OS is currently not supported by node-cachedir.');
function darwin (id) {
return path.join(os.homedir(), 'Library', 'Caches', id)
}
var implementation = (function () {
switch (os.platform()) {
case 'linux': return linux
case 'darwin': return darwin
default: throw new Error('Your OS is currently not supported by node-cachedir.')
}
}())
module.exports = function (id) {
if(typeof id !== 'string') {
throw new TypeError('id is not a string');
if (typeof id !== 'string') {
throw new TypeError('id is not a string')
}
if(id.length === 0) {
throw new Error('id cannot be empty');
if (id.length === 0) {
throw new Error('id cannot be empty')
}
if(/[^0-9a-zA-Z-]/.test(id)) {
throw new Error('id cannot contain special characters');
if (/[^0-9a-zA-Z-]/.test(id)) {
throw new Error('id cannot contain special characters')
}
return implementation(id);
};
return implementation(id)
}
{
"name": "cachedir",
"version": "0.1.1",
"version": "0.1.2",
"license": "MIT",
"author": "Linus Unnebäck <linus@folkdatorn.se>",
"main": "index.js",
"repository": {
"type": "git",
"url": "http://github.com/LinusU/node-cachedir.git"
"repository": "LinusU/node-cachedir",
"scripts": {
"test": "standard && mocha"
},
"devDependencies": {
"mocha": "^2.4.5",
"proxyquire": "^1.7.4",
"standard": "^6.0.8"
}
}

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