Socket
Socket
Sign inDemoInstall

fairmont

Package Overview
Dependencies
Maintainers
3
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fairmont - npm Package Compare versions

Comparing version 1.0.0-alpha-10 to 1.0.0-alpha-11

104

lib/fs.js
// Generated by CoffeeScript 1.9.1
(function() {
var assert, describe, fs, ref,
var assert, async, call, describe, fs, ref, ref1,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
ref = require("./generator"), call = ref.call, async = ref.async;
fs = function(f) {
var async, call, liftAll;
var liftAll;
liftAll = require("when/node").liftAll;
call = (require("when/generator")).call;
async = (require("when/generator")).lift;
return f(liftAll(require("fs")), {

@@ -17,6 +17,6 @@ call: call,

ref = require("./helpers"), describe = ref.describe, assert = ref.assert;
ref1 = require("./helpers"), describe = ref1.describe, assert = ref1.assert;
describe("File system functions", function(context) {
var chdir, exists, lines, read, read_stream, readdir, rm, rmdir, stat, stream, write;
var binary, chdir, curry, dirname, exists, is_directory, is_file, lines, mkdir, mkdirp, read, read_stream, readdir, ref2, rm, rmdir, stat, stream, write;
stat = function(path) {

@@ -32,6 +32,19 @@ return fs(function(arg) {

});
exists = stat;
exists = function(path) {
return fs(function(arg) {
var stat;
stat = arg.stat;
return call(function*() {
try {
(yield stat(path));
return true;
} catch (_error) {
return false;
}
});
});
};
context.test("exists", function*() {
(yield exists("test/test.json"));
return assert((yield exists("test/test.json")));
assert((yield exists("test/test.json")));
return assert(!((yield exists("test/does-not-exist"))));
});

@@ -186,5 +199,5 @@ read = function(path) {

rm = function(path) {
return fs({
unlink: unlink
})(function() {
return fs(function(arg) {
var unlink;
unlink = arg.unlink;
return unlink(path);

@@ -195,9 +208,63 @@ });

rmdir = function(path) {
return fs({
rmdir: rmdir
})(function() {
return fs(function(arg) {
var rmdir;
rmdir = arg.rmdir;
return rmdir(path);
});
};
context.test("rmdir");
context.test("rmdir", function() {});
is_directory = function(path) {
return fs(function(arg, arg1) {
var call, stat;
stat = arg.stat;
call = arg1.call;
return call(function*() {
return ((yield stat(path))).isDirectory();
});
});
};
context.test("is_directory", function*() {
return assert((yield is_directory("./test")));
});
is_file = function(path) {
return fs(function(arg, arg1) {
var call, stat;
stat = arg.stat;
call = arg1.call;
return call(function*() {
return ((yield stat(path))).isFile();
});
});
};
context.test("is_file", function*() {
return assert((yield is_file("./test/test.json")));
});
ref2 = require("./core"), curry = ref2.curry, binary = ref2.binary;
mkdir = curry(function(mode, path) {
return fs(function(arg) {
var mkdir;
mkdir = arg.mkdir;
return mkdir(path, mode);
});
});
context.test("mdkir", function*() {
(yield mkdir('0777', "./test/foobar"));
assert((yield is_directory("./test/foobar")));
return (yield rmdir("./test/foobar"));
});
dirname = require("path").dirname;
mkdirp = curry(binary(async(function*(mode, path) {
var parent;
parent = dirname(path);
if (!((yield exists(parent)))) {
(yield mkdirp(mode, parent));
}
return mkdir(mode, path);
})));
context.test("mkdirp", function*() {
(yield mkdirp('0777', "./test/foo/bar"));
assert((yield is_directory("./test/foo/bar")));
(yield rmdir("./test/foo/bar"));
return (yield rmdir("./test/foo"));
});
return module.exports = {

@@ -214,3 +281,6 @@ exists: exists,

rm: rm,
rmdir: rmdir
rmdir: rmdir,
is_directory: is_directory,
mkdir: mkdir,
mkdirp: mkdirp
};

@@ -217,0 +287,0 @@ });

@@ -8,3 +8,3 @@ // Generated by CoffeeScript 1.9.1

describe("String functions", function(context) {
var camel_case, capitalize, dashed, html_escape, plain_text, title_case, to_string, underscored, w;
var blank, camel_case, capitalize, dashed, empty, html_escape, plain_text, title_case, to_string, underscored, w;
to_string = function(x) {

@@ -85,2 +85,9 @@ return x.toString();

});
empty = blank = function(s) {
return s === "";
};
context.test("empty", function() {
assert(empty(""));
return assert(!blank("x"));
});
return module.exports = {

@@ -95,3 +102,5 @@ to_string: to_string,

html_escape: html_escape,
w: w
w: w,
blank: blank,
empty: empty
};

@@ -98,0 +107,0 @@ });

2

package.json
{
"name": "fairmont",
"version": "1.0.0-alpha-10",
"version": "1.0.0-alpha-11",
"description": "A collection of useful functions and utilities.",

@@ -5,0 +5,0 @@ "files": [

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