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

ai-lines

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ai-lines - npm Package Compare versions

Comparing version 0.0.1 to 1.0.0

24

index.js

@@ -1,3 +0,23 @@

export default function aiLines() {
return 42;
export default async function* aiLines(stream, separator = /\n/) {
let buff = { concat: s => s };
for await (const chunk of stream) {
const lines = chunk.split(separator);
const firstLine = lines.shift();
const lastLine = lines.pop();
buff = buff.concat(firstLine);
if (typeof lastLine === "string") {
yield buff;
buff = lastLine;
for (const otherPart of lines) {
yield otherPart;
}
}
}
if (typeof buff === "string") {
yield buff;
}
}

7

package.json
{
"name": "ai-lines",
"version": "0.0.1",
"version": "1.0.0",
"description": "Split an async iterable into lines",

@@ -13,3 +13,3 @@ "repository": "parro-it/ai-lines",

"scripts": {
"test": "node --harmony_async_iteration -r @std/esm test.js | tap-prettify - && linterjs .",
"test": "node --harmony_async_iteration -r @std/esm test.js | tap-colorize - && linterjs .",
"doc": "documentation readme index.js --section=API"

@@ -28,2 +28,5 @@ },

"@std/esm": "^0.16.0",
"ai-concat": "^1.0.0",
"ai-from-stream": "^1.0.0",
"asynciterable": "^1.0.1",
"documentation": "^5.3.3",

@@ -30,0 +33,0 @@ "linterjs": "^1.11.0",

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