Socket
Socket
Sign inDemoInstall

darwin

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

darwin - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

.npmignore

85

index.js

@@ -1,10 +0,77 @@

{
"name": "darwin",
"version": "0.0.1",
"description": "",
"main": "index.js",
"scripts": {
},
"author": "",
"license": "MIT"
var p = require('path');
var fs = require('fs-extra');
var glob = require("globby");
var noisy = false;
function darwin(base, files) {
noisy && console.log('darwin', base, files && files.length);
base = base || process.cwd();
files = files || [];
this.cd = function(newbase) {
noisy && console.log('base', newbase);
return new darwin(p.resolve(base, newbase));
};
this.glob = function(pattern, options) {
noisy && console.log('glob', base, pattern, options);
options || (options = {});
options.cwd = base;
files = glob.sync(pattern, options).map(function(file) {
return new File(base, file);
});
return new darwin(base, files);
};
this.each = function(fn) {
files.forEach(fn);
return this;
};
this.file = function(name) {
return new File(base, name);
};
this.get = function() {
return files.length && files[0].get();
};
}
function File(base, file) {
var path = p.resolve(base, file);
var content = null;
this.name = function() {
return file;
};
this.get = function() {
noisy && console.log(this.toString());
if (content == null) {
content = fs.readFileSync(path, 'UTF-8');
}
return content;
};
this.set = function(str) {
content = str;
return this;
};
this.write = function() {
noisy && console.log(this.toString());
if (content != null) {
fs.outputFileSync(path, content, 'UTF-8');
}
};
this.toString = function() {
return base + '+' + file + '=' + path;
};
}
module.exports = new darwin();
{
"name": "darwin",
"version": "0.0.1",
"version": "0.0.2",
"description": "",
"author": "Ali Shakiba",
"keywords": [
"fs",
"path",
"glob",
"math",
"file",
"directory",
"select",
"pipe",
"build",
"engine",
"make",
"generator",
"template",
"website",
"static"
],
"license": "MIT",

@@ -11,5 +28,7 @@ "repository": {

},
"main": "index.js",
"scripts": {
"dependencies": {
"fs-extra": "~0.13.0",
"glob": "~4.3.4",
"globby": "~1.1.0"
}
}
.project
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