Socket
Socket
Sign inDemoInstall

stream-transform

Package Overview
Dependencies
1
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.1.2

1

lib/es5/index.js

@@ -189,2 +189,3 @@ "use strict";

if (this.state.running === 0) {
this._ending = undefined;
return cb();

@@ -191,0 +192,0 @@ }

58

lib/es5/sync.js
"use strict";
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
// Generated by CoffeeScript 2.5.1
// # Stream Transformer Sync
// Provides a synchronous alternative to the CSV transformer.
// ## Usage
// `const records = transform(records, [options], handler)`
// ## Source Code
var clone, transform;
transform = require('.');
/*
Stream Transform - sync module
var _require = require('mixme');
Please look at the [project documentation](https://csv.js.org/transform/) for
additional information.
*/
var transform = require('.');
clone = _require.clone;
var _require = require('mixme'),
clone = _require.clone;
module.exports = function () {
var argument, callback, chunks, expected_handler_length, handler, i, j, k, len, len1, options, record, records, transformer, type; // Import arguments normalization
// Import arguments normalization
var handler, callback;
var options = {};
options = {};
for (i in arguments) {
var argument = arguments[i];
for (i = j = 0, len = arguments.length; j < len; i = ++j) {
argument = arguments[i];
type = _typeof(argument);
var type = _typeof(argument);

@@ -49,3 +54,3 @@ if (argument === null) {

expected_handler_length = 1;
var expected_handler_length = 1;

@@ -61,13 +66,22 @@ if (options.params) {

chunks = [];
transformer = new transform.Transformer(options, handler);
var chunks = [];
var transformer = new transform.Transformer(options, handler);
transformer.push = function (chunk) {
return chunks.push(chunk);
chunks.push(chunk);
};
for (k = 0, len1 = records.length; k < len1; k++) {
record = records[k];
var _iterator = _createForOfIteratorHelper(records),
_step;
transformer._transform(record, null, function () {});
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var record = _step.value;
transformer._transform(record, null, function () {});
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}

@@ -74,0 +88,0 @@

@@ -160,2 +160,3 @@ // Generated by CoffeeScript 2.5.1

if (this.state.running === 0) {
this._ending = undefined
return cb();

@@ -162,0 +163,0 @@ }

@@ -1,62 +0,56 @@

// Generated by CoffeeScript 2.5.1
// # Stream Transformer Sync
// Provides a synchronous alternative to the CSV transformer.
/*
Stream Transform - sync module
// ## Usage
Please look at the [project documentation](https://csv.js.org/transform/) for
additional information.
*/
// `const records = transform(records, [options], handler)`
const transform = require('.')
const {clone} = require('mixme')
// ## Source Code
var clone, transform;
transform = require('.');
({clone} = require('mixme'));
module.exports = function() {
var argument, callback, chunks, expected_handler_length, handler, i, j, k, len, len1, options, record, records, transformer, type;
module.exports = function(){
// Import arguments normalization
options = {};
for (i = j = 0, len = arguments.length; j < len; i = ++j) {
argument = arguments[i];
type = typeof argument;
if (argument === null) {
type = 'null';
} else if (type === 'object' && Array.isArray(argument)) {
type = 'array';
let handler, callback
let options = {}
for(i in arguments){
const argument = arguments[i]
let type = typeof argument
if(argument === null){
type = 'null'
}else if(type === 'object' && Array.isArray(argument)){
type = 'array'
}
if (type === 'array') {
records = argument;
} else if (type === 'object') {
options = clone(argument);
} else if (type === 'function') {
if (handler && i === arguments.length - 1) {
callback = argument;
} else {
handler = argument;
if(type === 'array'){
records = argument
}else if(type === 'object'){
options = clone(argument)
}else if(type === 'function'){
if(handler && i === arguments.length - 1){
callback = argument
}else{
handler = argument
}
} else if (type !== 'null') {
throw new Error(`Invalid Arguments: got ${JSON.stringify(argument)} at position ${i}`);
}else if(type !== 'null'){
throw new Error(`Invalid Arguments: got ${JSON.stringify(argument)} at position ${i}`)
}
}
// Validate arguments
expected_handler_length = 1;
if (options.params) {
expected_handler_length++;
let expected_handler_length = 1
if(options.params){
expected_handler_length++
}
if (handler.length > expected_handler_length) {
throw Error('Invalid Handler: only synchonous handlers are supported');
if(handler.length > expected_handler_length){
throw Error('Invalid Handler: only synchonous handlers are supported')
}
// Start transformation
chunks = [];
transformer = new transform.Transformer(options, handler);
transformer.push = function(chunk) {
return chunks.push(chunk);
};
for (k = 0, len1 = records.length; k < len1; k++) {
record = records[k];
transformer._transform(record, null, (function() {}));
const chunks = []
const transformer = new transform.Transformer(options, handler)
transformer.push = function(chunk){
chunks.push(chunk)
}
return chunks;
};
for(const record of records){
transformer._transform(record, null, function(){})
}
return chunks
}
{
"version": "2.1.0",
"version": "2.1.2",
"name": "stream-transform",

@@ -51,3 +51,2 @@ "description": "Object transformations implementing the Node.js `stream.Transform` API",

],
"optionalDependencies": {},
"main": "./lib",

@@ -69,10 +68,4 @@ "mocha": {

"build:browserify": "browserify lib/index.js --transform babelify --standalone parse > lib/browser/index.js && browserify lib/sync.js --transform babelify --standalone parse > lib/browser/sync.js",
"build:coffee": "coffee -b -o lib src",
"build": "npm run build:coffee && npm run build:babel && npm run build:browserify",
"preversion": "grep '## Trunk' CHANGELOG.md && npm test && cp lib/*.ts lib/es5 && git add lib/es5/*.ts",
"version": "version=`grep '^ \"version\": ' package.json | sed 's/.*\"\\([0-9\\.]*\\)\".*/\\1/'` && sed -i \"s/## Trunk/## Version $version/\" CHANGELOG.md && git add CHANGELOG.md",
"postversion": "git push && git push --tags && npm publish",
"patch": "npm version patch -m 'Bump to version %s'",
"minor": "npm version minor -m 'Bump to version %s'",
"major": "npm version major -m 'Bump to version %s'",
"build": "npm run build:babel && npm run build:browserify",
"preversion": "cp lib/*.ts lib/es5 && git add lib/es5/*.ts",
"pretest": "npm run build",

@@ -89,3 +82,4 @@ "test": "mocha test/**/*.{coffee,ts}"

"mixme": "^0.5.0"
}
},
"gitHead": "6b34c28a523bb4c666a5e8a7738640b71edf7b05"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc