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

gear

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gear - npm Package Compare versions

Comparing version 0.7.7 to 0.7.8

test/fixtures/image.png

27

lib/blob.js

@@ -14,22 +14,13 @@ /*

*
* @param parts {String|Blob|Array} Create new Blob from String/Blob or Array of String/Blob.
* @param parts {Buffer|String|Blob|Array} Create new Blob from String/Blob or Array of String/Blob.
*/
var Blob = exports.Blob = function Blob(parts, properties) {
if (parts === undefined) {
parts = [];
} else {
if (!Array.isArray(parts)) {
parts = [parts];
}
}
parts = typeof parts === 'undefined' ? [] : Array.prototype.concat(parts);
properties = properties || {};
var result = '',
var result = parts.length ? parts.shift() : '',
props = {},
self = this;
parts.forEach(function(part) {
result += part;
function getProps(part) {
if (part instanceof Blob) {

@@ -40,2 +31,8 @@ Object.keys(part).forEach(function(attr) {

}
}
getProps(result);
parts.forEach(function(part) {
result += part;
getProps(part);
});

@@ -63,3 +60,3 @@

var fs = require('fs');
fs.readFile(name, encoding, function(err, data) {
fs.readFile(name, encoding === 'bin' ? undefined : encoding, function(err, data) {
if (err) {

@@ -91,3 +88,3 @@ callback(err);

function writeFile(filename, b) {
fs.writeFile(filename, b.result, function(err) {
fs.writeFile(filename, b.result, encoding === 'bin' ? undefined : encoding, function(err) {
callback(err, new Blob(b, {name: filename}));

@@ -94,0 +91,0 @@ });

@@ -19,10 +19,4 @@ /*

// Turn input into an array even if undefined
function arrayize(arr) {
if (arr === undefined) {
arr = [];
} else if (!Array.isArray(arr)) {
arr = [arr];
}
return arr;
return typeof arr === 'undefined' ? [] : Array.prototype.concat(arr);
}

@@ -29,0 +23,0 @@

{
"name": "gear",
"version": "0.7.7",
"version": "0.7.8",
"description": "Gear.js - Task-based build system.",

@@ -5,0 +5,0 @@ "author": "Stephen Murphy <stephen@hypernaut.com>",

@@ -1,2 +0,9 @@

var Blob = require('../lib/blob').Blob;
var Blob = require('../lib/blob').Blob,
path = require('path'),
fs = require('fs'),
Crypto = require('crypto'),
fixtures = {
input: 'test/fixtures/image.png',
output: 'testing/image_{checksum}.png'
};

@@ -10,3 +17,16 @@ describe('Blob', function() {

});
it('should preserve encoding', function(done) {
var checksum = Crypto.createHash('md5');
checksum.update(fs.readFileSync(fixtures.input));
Blob.readFile(fixtures.input, 'bin', function(err, blob) {
Blob.writeFile(fixtures.output, blob, 'bin', function() {
var file = fixtures.output.replace('{checksum}', checksum.digest('hex'));
path.existsSync(file).should.equal(true);
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