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

rightclick

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rightclick - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

4

changelog.md
# rightClick Changelog
### 31 March 2014, 0.6.0
* Copy & Cut now accept optional suffix argument
### 28 March 2014, 0.5.0

@@ -4,0 +8,0 @@

18

lib/copy.js
var fs = require('fs'),
path = require('path');
module.exports = function (docPath) {
module.exports = function (docPath, suffix) {

@@ -13,5 +13,8 @@ docPath = docPath || [];

if (typeof docPath === 'string') {
docPath = [docPath];
}
// Same for suffix
if (typeof suffix === 'string') {
suffix = [suffix];
}

@@ -45,4 +48,11 @@

// Copy file content to clipboard.
clip[docPath] = fs.readFileSync(fullPath, enc);
if (suffix) {
var fileSuffix = new RegExp(docPath.split(/\./).pop());
if (fileSuffix.test(suffix)) {
clip[docPath] = fs.readFileSync(fullPath, enc);
}
} else {
// Copy file content to clipboard.
clip[docPath] = fs.readFileSync(fullPath, enc);
}

@@ -49,0 +59,0 @@ }

@@ -1,4 +0,4 @@

module.exports = function (docPath) {
module.exports = function (docPath, suffix) {
this.copy(docPath).del(docPath);
this.copy(docPath, suffix).del(docPath);

@@ -5,0 +5,0 @@ return this;

{
"name": "rightclick",
"description": "Cut, copy, paste and delete for node.js",
"version": "0.5.0",
"version": "0.6.0",
"keywords": [

@@ -6,0 +6,0 @@ "cut",

@@ -36,2 +36,8 @@ # rightClick [![Build Status](https://secure.travis-ci.org/mattyod/rightClick.png)](http://travis-ci.org/mattyod/rightClick)

As of version 0.6.0 cut now accepts an optional suffix argument which can be either a string or an array. If given rightClick will cut files with the given suffix.
The following would only cut files with the suffix .js & .css from within subFolder.
rightClick('./folder').cut(['subFolder'], ['js', 'css'])
### copy()

@@ -51,2 +57,8 @@

As of version 0.6.0 copy now accepts an optional suffix argument which can be either a string or an array. If given rightClick will copy files with the given suffix.
The following would only copy files with the suffix .js & .css from within subFolder.
rightClick('./folder').copy(['subFolder'], ['js', 'css'])
### paste()

@@ -53,0 +65,0 @@

@@ -101,4 +101,24 @@ // Helper modules

},
'copy with suffix': function (test) {
test.expect(3);
// Call tested module
this.rightClick().copy('mixed', ['txt', 'js']);
test.equal(this.clipboard.files.mixed['text.txt'].toString(), 'text file\n',
'Text (.txt) file has been copied');
test.equal(this.clipboard.files.mixed['javascript.js'].toString(), 'console.log(\'a\');\n',
'JavaScript (.js) file has been copied');
test.equal(this.clipboard.files.mixed['other.rb'], undefined,
'Other file has not been copied');
test.done();
}
};

@@ -13,3 +13,4 @@ // Helper modules

'./test/sandbox/cut/deep/deeper/': null,
'./test/sandbox/cut/deep/deeper/file.txt': 'ccc'
'./test/sandbox/cut/deep/deeper/file.txt': 'ccc',
'./test/sandbox/cut/deep/other.rb': 'xxx'
};

@@ -23,2 +24,3 @@

'./test/sandbox/cut/deep/file.txt',
'./test/sandbox/cut/deep/other.rb',
'./test/sandbox/cut/deep'

@@ -66,3 +68,3 @@ ];

test.expect(5);
test.expect(6);

@@ -86,2 +88,5 @@ // Call tested module

test.equal(that.clipboard.files.deep['other.rb'].toString(), 'xxx',
'The file is available on the clipboard');
test.ok(typeof that.clipboard.files.deep.deeper === 'object',

@@ -95,4 +100,20 @@ 'Folder object has been created on the clipboard for deeper');

},
'cut with suffix': function (test) {
test.expect(2);
// Call tested module
var that = rightClick('./test/sandbox/cut/').cut('deep', ['txt']);
test.equal(that.clipboard.files.deep['file.txt'].toString(), 'bbb',
'The file is available on the clipboard');
test.equal(that.clipboard.files.deep['other.rb'], undefined,
'The file has not been cut');
test.done();
}
};
};
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