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

can-ndjson-stream

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

can-ndjson-stream - npm Package Compare versions

Comparing version 0.1.6 to 0.1.7

CONTRIBUTING.md

10

can-ndjson-stream-test.js

@@ -89,6 +89,6 @@ var QUnit = require("steal-qunit");

conditionalAsyncTest('maleformed json', function(assert) {
var maleformed_string = "{\"1\":2}\n{sss: 2}";
conditionalAsyncTest('malformed json', function(assert) {
var malformed_string = "{\"1\":2}\n{sss: 2}";
var readObjects = [];
var todoStream = ndjsonStream( readableStreamFromString(maleformed_string) );
var todoStream = ndjsonStream( readableStreamFromString(malformed_string) );
var reader = todoStream.getReader();

@@ -109,6 +109,6 @@ var errorCaught = false;

allDone.then(function(){
assert.strictEqual(errorCaught, true, "maleformed json string should cause an error");
assert.strictEqual(errorCaught, true, "malformed json string should cause an error");
QUnit.start();
}, function(){
assert.strictEqual(errorCaught, true, "rejected: maleformed json string should cause an error");
assert.strictEqual(errorCaught, true, "rejected: malformed json string should cause an error");
QUnit.start();

@@ -115,0 +115,0 @@ });

@@ -1,3 +0,8 @@

/*can-ndjson-stream@0.1.5#can-ndjson-stream*/
define(function (require, exports, module) {
/*can-ndjson-stream@0.1.6#can-ndjson-stream*/
define([
'require',
'exports',
'module',
'can-namespace'
], function (require, exports, module) {
var namespace = require('can-namespace');

@@ -4,0 +9,0 @@ var ndjsonStream = function (response) {

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

/*can-ndjson-stream@0.1.5#can-ndjson-stream*/
/*can-ndjson-stream@0.1.6#can-ndjson-stream*/
var namespace = require('can-namespace');

@@ -3,0 +3,0 @@ var ndjsonStream = function (response) {

/*[global-shim-start]*/
(function(exports, global, doEval){ // jshint ignore:line
(function(exports, global, doEval) {
// jshint ignore:line
var origDefine = global.define;
var get = function(name){
var get = function(name) {
var parts = name.split("."),
cur = global,
i;
for(i = 0 ; i < parts.length; i++){
if(!cur) {
for (i = 0; i < parts.length; i++) {
if (!cur) {
break;

@@ -17,10 +18,12 @@ }

};
var set = function(name, val){
var set = function(name, val) {
var parts = name.split("."),
cur = global,
i, part, next;
for(i = 0; i < parts.length - 1; i++) {
i,
part,
next;
for (i = 0; i < parts.length - 1; i++) {
part = parts[i];
next = cur[part];
if(!next) {
if (!next) {
next = cur[part] = {};

@@ -33,15 +36,24 @@ }

};
var useDefault = function(mod){
if(!mod || !mod.__esModule) return false;
var esProps = { __esModule: true, "default": true };
for(var p in mod) {
if(!esProps[p]) return false;
var useDefault = function(mod) {
if (!mod || !mod.__esModule) return false;
var esProps = { __esModule: true, default: true };
for (var p in mod) {
if (!esProps[p]) return false;
}
return true;
};
var modules = (global.define && global.define.modules) ||
(global._define && global._define.modules) || {};
var ourDefine = global.define = function(moduleName, deps, callback){
var hasCjsDependencies = function(deps) {
return (
deps[0] === "require" && deps[1] === "exports" && deps[2] === "module"
);
};
var modules =
(global.define && global.define.modules) ||
(global._define && global._define.modules) ||
{};
var ourDefine = (global.define = function(moduleName, deps, callback) {
var module;
if(typeof deps === "function") {
if (typeof deps === "function") {
callback = deps;

@@ -52,21 +64,25 @@ deps = [];

i;
for(i =0; i < deps.length; i++) {
args.push( exports[deps[i]] ? get(exports[deps[i]]) : ( modules[deps[i]] || get(deps[i]) ) );
for (i = 0; i < deps.length; i++) {
args.push(
exports[deps[i]]
? get(exports[deps[i]])
: modules[deps[i]] || get(deps[i])
);
}
// CJS has no dependencies but 3 callback arguments
if(!deps.length && callback.length) {
if (hasCjsDependencies(deps) || (!deps.length && callback.length)) {
module = { exports: {} };
var require = function(name) {
args[0] = function(name) {
return exports[name] ? get(exports[name]) : modules[name];
};
args.push(require, module.exports, module);
}
// Babel uses the exports and module object.
else if(!args[0] && deps[0] === "exports") {
args[1] = module.exports;
args[2] = module;
} else if (!args[0] && deps[0] === "exports") {
// Babel uses the exports and module object.
module = { exports: {} };
args[0] = module.exports;
if(deps[1] === "module") {
if (deps[1] === "module") {
args[1] = module;
}
} else if(!args[0] && deps[0] === "module") {
} else if (!args[0] && deps[0] === "module") {
args[0] = { id: moduleName };

@@ -85,4 +101,4 @@ }

var globalExport = exports[moduleName];
if(globalExport && !get(globalExport)) {
if(useDefault(result)) {
if (globalExport && !get(globalExport)) {
if (useDefault(result)) {
result = result["default"];

@@ -92,15 +108,15 @@ }

}
};
});
global.define.orig = origDefine;
global.define.modules = modules;
global.define.amd = true;
ourDefine("@loader", [], function(){
ourDefine("@loader", [], function() {
// shim for @@global-helpers
var noop = function(){};
var noop = function() {};
return {
get: function(){
get: function() {
return { prepareGlobal: noop, retrieveGlobal: noop };
},
global: global,
__exec: function(__load){
__exec: function(__load) {
doEval(__load.source, global);

@@ -110,7 +126,11 @@ }

});
}
)({"can-namespace":"can"},window,function(__$source__, __$global__) { // jshint ignore:line
eval("(function() { " + __$source__ + " \n }).call(__$global__);");
}
)
})(
{ "can-namespace": "can" },
typeof self == "object" && self.Object == Object ? self : window,
function(__$source__, __$global__) {
// jshint ignore:line
eval("(function() { " + __$source__ + " \n }).call(__$global__);");
}
);
/*can-namespace@1.0.0#can-namespace*/

@@ -120,4 +140,9 @@ define('can-namespace', function (require, exports, module) {

});
/*can-ndjson-stream@0.1.5#can-ndjson-stream*/
define('can-ndjson-stream', function (require, exports, module) {
/*can-ndjson-stream@0.1.6#can-ndjson-stream*/
define('can-ndjson-stream', [
'require',
'exports',
'module',
'can-namespace'
], function (require, exports, module) {
var namespace = require('can-namespace');

@@ -181,6 +206,6 @@ var ndjsonStream = function (response) {

/*[global-shim-end]*/
(function(){ // jshint ignore:line
window._define = window.define;
window.define = window.define.orig;
(function(global) { // jshint ignore:line
global._define = global.define;
global.define = global.define.orig;
}
)();
)(typeof self == "object" && self.Object == Object ? self : window);
@module {function} can-ndjson-stream
@parent can-ecosystem
@parent can-data-modeling
@collection can-ecosystem
@package ../package.json

@@ -4,0 +5,0 @@

{
"name": "can-ndjson-stream",
"version": "0.1.6",
"version": "0.1.7",
"description": "",

@@ -20,3 +20,3 @@ "homepage": "",

"testee-local": "testee test.html --browsers chrome",
"test": "npm run jshint && node test.js",
"test": "npm run detect-cycle && npm run jshint && node test.js",
"test-local": "npm run jshint && npm run testee-local",

@@ -31,3 +31,4 @@ "jshint": "jshint ./*.js --config",

"http-server": "http-server -p 3000 --silent",
"ci": "npm run build && npm run test && node ./test-sauce-labs.js"
"ci": "npm run build && npm run test && node ./test-sauce-labs.js",
"detect-cycle": "detect-cyclic-packages --ignore done-serve"
},

@@ -49,2 +50,3 @@ "main": "can-ndjson-stream",

"devDependencies": {
"detect-cyclic-packages": "^1.1.0",
"http-server": "^0.10.0",

@@ -56,4 +58,4 @@ "jshint": "^2.9.1",

"steal-tools": "^1.0.1",
"test-saucelabs": "0.0.1",
"testee": "^0.4.0"
"test-saucelabs": "0.0.2",
"testee": "^0.7.0"
},

@@ -60,0 +62,0 @@ "licenses": [

# can-ndjson-stream
[![Join the chat at https://gitter.im/canjs/canjs](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/canjs/canjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/canjs/can-ndjson-stream/blob/master/license.md)
[![npm version](https://badge.fury.io/js/can-ndjson-stream.svg)](https://www.npmjs.com/package/can-ndjson-stream)
[![Travis build status](https://travis-ci.org/canjs/can-ndjson-stream.svg?branch=master)](https://travis-ci.org/canjs/can-ndjson-stream)
[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/canjs/can-ndjson-stream?branch=master&svg=true)](https://ci.appveyor.com/project/matthewp/can-ndjson-stream)
[![Coverage status](https://coveralls.io/repos/github/canjs/can-ndjson-stream/badge.svg?branch=master)](https://coveralls.io/github/canjs/can-ndjson-stream?branch=master)
[![Greenkeeper badge](https://badges.greenkeeper.io/canjs/can-ndjson-stream.svg)](https://greenkeeper.io/)
[![Build Status](https://travis-ci.org/canjs/can-ndjson-stream.png?branch=master)](https://travis-ci.org/canjs/can-ndjson-stream)
[![Build Status](https://saucelabs.com/browser-matrix/can-ndjson-stream.svg)](https://saucelabs.com/beta/builds/270fe2884b8940f68684fae62c89c39e)
Most web applications encounter problems of latency because they process data discretely instead of in streams. `ndjsonstream()` converts a ReadableStream of raw ndjson data into a ReadableStream of Javascript objects.
## Demo
## Documentation
All the demo code can be found in the `demo/` directory.
Read the [can-ndjson-stream API docs on CanJS.com](https://canjs.com/doc/can-ndjson-stream.html).
1. To get started, run the demo server.
## Changelog
```shell
cd demo
node server.js
```
See the [latest releases on GitHub](https://github.com/canjs/can-ndjson-stream/releases).
2. Navigate to localhost:8080/demo/can-ndjson-stream.html to see the demo in action.
3. Check out the demo code in `demo/can-ndjson-stream.html`.
![ndjsonStream Visual](ndjsonStream.gif)
## Contributing
### Making a Build
The [contribution guide](https://github.com/canjs/can-ndjson-stream/blob/master/CONTRIBUTING.md) has information on getting help, reporting bugs, developing locally, and more.
To make a build of the distributables into `dist/` in the cloned repository run
## License
```
npm install
node build
```
[MIT](https://github.com/canjs/can-ndjson-stream/blob/master/license.md)
### Running the tests
Tests can run in the browser by opening a webserver and visiting the `test.html` page.
Automated tests that run the tests from the command line in Chrome can be run with
```
npm test
```
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