diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-10-10 03:43:44 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-10-10 03:43:44 +0200 |
commit | abd94a7f5a50f43c797a11b53549ae48fff667c3 (patch) | |
tree | ab8ed457f65cdd72e13e0571d2975729428f1551 /node_modules/clone-stats | |
parent | a0247c6a3fd6a09a41a7e35a3441324c4dcb58be (diff) | |
download | wallet-core-abd94a7f5a50f43c797a11b53549ae48fff667c3.tar.xz |
add node_modules to address #4364
Diffstat (limited to 'node_modules/clone-stats')
-rw-r--r-- | node_modules/clone-stats/LICENSE.md | 21 | ||||
-rw-r--r-- | node_modules/clone-stats/README.md | 17 | ||||
-rw-r--r-- | node_modules/clone-stats/index.js | 13 | ||||
-rw-r--r-- | node_modules/clone-stats/package.json | 94 | ||||
-rw-r--r-- | node_modules/clone-stats/test.js | 36 |
5 files changed, 181 insertions, 0 deletions
diff --git a/node_modules/clone-stats/LICENSE.md b/node_modules/clone-stats/LICENSE.md new file mode 100644 index 000000000..146cb32a7 --- /dev/null +++ b/node_modules/clone-stats/LICENSE.md @@ -0,0 +1,21 @@ +## The MIT License (MIT) ## + +Copyright (c) 2014 Hugh Kennedy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/clone-stats/README.md b/node_modules/clone-stats/README.md new file mode 100644 index 000000000..8b12b6fa5 --- /dev/null +++ b/node_modules/clone-stats/README.md @@ -0,0 +1,17 @@ +# clone-stats [![Flattr this!](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=hughskennedy&url=http://github.com/hughsk/clone-stats&title=clone-stats&description=hughsk/clone-stats%20on%20GitHub&language=en_GB&tags=flattr,github,javascript&category=software)[![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) # + +Safely clone node's +[`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) instances without +losing their class methods, i.e. `stat.isDirectory()` and co. + +## Usage ## + +[![clone-stats](https://nodei.co/npm/clone-stats.png?mini=true)](https://nodei.co/npm/clone-stats) + +### `copy = require('clone-stats')(stat)` ### + +Returns a clone of the original `fs.Stats` instance (`stat`). + +## License ## + +MIT. See [LICENSE.md](http://github.com/hughsk/clone-stats/blob/master/LICENSE.md) for details. diff --git a/node_modules/clone-stats/index.js b/node_modules/clone-stats/index.js new file mode 100644 index 000000000..e797cfe6e --- /dev/null +++ b/node_modules/clone-stats/index.js @@ -0,0 +1,13 @@ +var Stat = require('fs').Stats + +module.exports = cloneStats + +function cloneStats(stats) { + var replacement = new Stat + + Object.keys(stats).forEach(function(key) { + replacement[key] = stats[key] + }) + + return replacement +} diff --git a/node_modules/clone-stats/package.json b/node_modules/clone-stats/package.json new file mode 100644 index 000000000..450a4ba30 --- /dev/null +++ b/node_modules/clone-stats/package.json @@ -0,0 +1,94 @@ +{ + "_args": [ + [ + { + "raw": "clone-stats@^0.0.1", + "scope": null, + "escapedName": "clone-stats", + "name": "clone-stats", + "rawSpec": "^0.0.1", + "spec": ">=0.0.1 <0.0.2", + "type": "range" + }, + "/home/dold/repos/taler/wallet-webex/node_modules/gulp-util/node_modules/vinyl" + ] + ], + "_from": "clone-stats@>=0.0.1 <0.0.2", + "_id": "clone-stats@0.0.1", + "_inCache": true, + "_location": "/clone-stats", + "_npmUser": { + "name": "hughsk", + "email": "hughskennedy@gmail.com" + }, + "_npmVersion": "1.3.22", + "_phantomChildren": {}, + "_requested": { + "raw": "clone-stats@^0.0.1", + "scope": null, + "escapedName": "clone-stats", + "name": "clone-stats", + "rawSpec": "^0.0.1", + "spec": ">=0.0.1 <0.0.2", + "type": "range" + }, + "_requiredBy": [ + "/gulp-gzip/vinyl", + "/gulp-sourcemaps/vinyl", + "/gulp-sym/vinyl", + "/gulp-util/vinyl", + "/gulp/vinyl", + "/vinyl-fs/vinyl" + ], + "_resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz", + "_shasum": "b88f94a82cf38b8791d58046ea4029ad88ca99d1", + "_shrinkwrap": null, + "_spec": "clone-stats@^0.0.1", + "_where": "/home/dold/repos/taler/wallet-webex/node_modules/gulp-util/node_modules/vinyl", + "author": { + "name": "Hugh Kennedy", + "email": "hughskennedy@gmail.com", + "url": "http://hughsk.io/" + }, + "browser": "index.js", + "bugs": { + "url": "https://github.com/hughsk/clone-stats/issues" + }, + "dependencies": {}, + "description": "Safely clone node's fs.Stats instances without losing their class methods", + "devDependencies": { + "tape": "~2.3.2" + }, + "directories": {}, + "dist": { + "shasum": "b88f94a82cf38b8791d58046ea4029ad88ca99d1", + "tarball": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz" + }, + "homepage": "https://github.com/hughsk/clone-stats", + "keywords": [ + "stats", + "fs", + "clone", + "copy", + "prototype" + ], + "license": "MIT", + "main": "index.js", + "maintainers": [ + { + "name": "hughsk", + "email": "hughskennedy@gmail.com" + } + ], + "name": "clone-stats", + "optionalDependencies": {}, + "readme": "ERROR: No README data found!", + "repository": { + "type": "git", + "url": "git://github.com/hughsk/clone-stats.git" + }, + "scripts": { + "test": "node test" + }, + "version": "0.0.1" +} diff --git a/node_modules/clone-stats/test.js b/node_modules/clone-stats/test.js new file mode 100644 index 000000000..e4bb2814d --- /dev/null +++ b/node_modules/clone-stats/test.js @@ -0,0 +1,36 @@ +var test = require('tape') +var clone = require('./') +var fs = require('fs') + +test('file', function(t) { + compare(t, fs.statSync(__filename)) + t.end() +}) + +test('directory', function(t) { + compare(t, fs.statSync(__dirname)) + t.end() +}) + +function compare(t, stat) { + var copy = clone(stat) + + t.deepEqual(stat, copy, 'clone has equal properties') + t.ok(stat instanceof fs.Stats, 'original is an fs.Stat') + t.ok(copy instanceof fs.Stats, 'copy is an fs.Stat') + + ;['isDirectory' + , 'isFile' + , 'isBlockDevice' + , 'isCharacterDevice' + , 'isSymbolicLink' + , 'isFIFO' + , 'isSocket' + ].forEach(function(method) { + t.equal( + stat[method].call(stat) + , copy[method].call(copy) + , 'equal value for stat.' + method + '()' + ) + }) +} |