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

@promptbook/utils

Package Overview
Dependencies
Maintainers
1
Versions
470
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@promptbook/utils - npm Package Compare versions

Comparing version 0.17.0 to 0.18.0

27

esm/index.es.js

@@ -335,23 +335,24 @@ import spaceTrim from 'spacetrim';

var _a = options || {}, _b = _a.isTrimmed, isTrimmed = _b === void 0 ? true : _b, _c = _a.isIntroduceSentenceRemoved, isIntroduceSentenceRemoved = _c === void 0 ? true : _c;
var originalText = text;
var trimmedText = text;
// Remove leading and trailing spaces and newlines
if (isTrimmed) {
text = spaceTrim(text);
trimmedText = spaceTrim(trimmedText);
}
var processedText = trimmedText;
if (isIntroduceSentenceRemoved) {
var introduceSentenceRegex = /^[a-zฤ›ลกฤล™ลพรฝรกรญรฉรบลฏ:\s]*/i;
var introduceSentenceRegex = /^[a-zฤ›ลกฤล™ลพรฝรกรญรฉรบลฏ:\s]*:\s*/i;
if (introduceSentenceRegex.test(text)) {
// Remove the introduce sentence and quotes by replacing it with an empty string
text = text.replace(introduceSentenceRegex, '');
processedText = processedText.replace(introduceSentenceRegex, '');
}
text = spaceTrim(text);
processedText = spaceTrim(processedText);
}
if (text.length < 3) {
return originalText;
if (processedText.length < 3) {
return trimmedText;
}
if (text.includes('\n')) {
return originalText;
if (processedText.includes('\n')) {
return trimmedText;
}
// Remove the quotes by extracting the substring without the first and last characters
var unquotedText = text.slice(1, -1);
var unquotedText = processedText.slice(1, -1);
// Check if the text starts and ends with quotes

@@ -368,6 +369,6 @@ if ([

var _b = __read(_a, 2), startQuote = _b[0], endQuote = _b[1];
if (!text.startsWith(startQuote)) {
if (!processedText.startsWith(startQuote)) {
return false;
}
if (!text.endsWith(endQuote)) {
if (!processedText.endsWith(endQuote)) {
return false;

@@ -386,3 +387,3 @@ }

else {
return originalText;
return processedText;
}

@@ -389,0 +390,0 @@ }

{
"name": "@promptbook/utils",
"version": "0.17.0",
"version": "0.18.0",
"description": "Library to supercharge your use of large language models",

@@ -40,3 +40,3 @@ "private": false,

"peerDependencies": {
"@promptbook/core": "0.17.0"
"@promptbook/core": "0.18.0"
},

@@ -43,0 +43,0 @@ "main": "./umd/index.umd.js",

@@ -343,23 +343,24 @@ (function (global, factory) {

var _a = options || {}, _b = _a.isTrimmed, isTrimmed = _b === void 0 ? true : _b, _c = _a.isIntroduceSentenceRemoved, isIntroduceSentenceRemoved = _c === void 0 ? true : _c;
var originalText = text;
var trimmedText = text;
// Remove leading and trailing spaces and newlines
if (isTrimmed) {
text = spaceTrim__default["default"](text);
trimmedText = spaceTrim__default["default"](trimmedText);
}
var processedText = trimmedText;
if (isIntroduceSentenceRemoved) {
var introduceSentenceRegex = /^[a-zฤ›ลกฤล™ลพรฝรกรญรฉรบลฏ:\s]*/i;
var introduceSentenceRegex = /^[a-zฤ›ลกฤล™ลพรฝรกรญรฉรบลฏ:\s]*:\s*/i;
if (introduceSentenceRegex.test(text)) {
// Remove the introduce sentence and quotes by replacing it with an empty string
text = text.replace(introduceSentenceRegex, '');
processedText = processedText.replace(introduceSentenceRegex, '');
}
text = spaceTrim__default["default"](text);
processedText = spaceTrim__default["default"](processedText);
}
if (text.length < 3) {
return originalText;
if (processedText.length < 3) {
return trimmedText;
}
if (text.includes('\n')) {
return originalText;
if (processedText.includes('\n')) {
return trimmedText;
}
// Remove the quotes by extracting the substring without the first and last characters
var unquotedText = text.slice(1, -1);
var unquotedText = processedText.slice(1, -1);
// Check if the text starts and ends with quotes

@@ -376,6 +377,6 @@ if ([

var _b = __read(_a, 2), startQuote = _b[0], endQuote = _b[1];
if (!text.startsWith(startQuote)) {
if (!processedText.startsWith(startQuote)) {
return false;
}
if (!text.endsWith(endQuote)) {
if (!processedText.endsWith(endQuote)) {
return false;

@@ -394,3 +395,3 @@ }

else {
return originalText;
return processedText;
}

@@ -397,0 +398,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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