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

@promptbook/execute-javascript

Package Overview
Dependencies
Maintainers
1
Versions
567
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@promptbook/execute-javascript - npm Package Compare versions

Comparing version 0.17.0 to 0.18.0

27

esm/index.es.js

@@ -192,23 +192,24 @@ import { capitalize, decapitalize, nameToUriPart, nameToUriParts, removeDiacritics, normalizeWhitespaces, normalizeToKebabCase, normalizeTo_camelCase, normalizeTo_snake_case, normalizeTo_PascalCase, parseKeywordsFromString, normalizeTo_SCREAMING_CASE } from 'n12';

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

@@ -225,6 +226,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;

@@ -243,3 +244,3 @@ }

else {
return originalText;
return processedText;
}

@@ -246,0 +247,0 @@ }

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

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

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

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

@@ -198,23 +198,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

@@ -231,6 +232,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;

@@ -249,3 +250,3 @@ }

else {
return originalText;
return processedText;
}

@@ -252,0 +253,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