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

melody-runtime

Package Overview
Dependencies
Maintainers
3
Versions
82
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

melody-runtime - npm Package Compare versions

Comparing version 1.2.0-commit.33988325 to 1.2.0-commit.10cb706c

33

lib/index.esm.js

@@ -762,2 +762,33 @@ import _isString from 'lodash/isString';

function trim(str, charList) {
var side = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'both';
if (charList === undefined && side === 'both') {
// Use String.prototype.trim() for efficiency
return String(str).trim();
}
if (side !== 'both' && side !== 'left' && side !== 'right') {
throw new Error('Filter "trim". Invalid value ' + side + ' for parameter "side". Valid values are "both", "left", "right".');
}
var strLen = str.length;
var trimStart = 0;
if (side === 'both' || side === 'left') {
while (trimStart < strLen && charList.indexOf(str[trimStart]) !== -1) {
trimStart++;
}
}
var trimEnd = strLen;
if (side === 'both' || side === 'right') {
while (trimEnd > 0 && charList.indexOf(str[trimEnd - 1]) !== -1) {
trimEnd--;
}
}
return str.substr(trimStart, trimEnd - trimStart);
}
var MAX_SAFE_INTEGER = 'MAX_SAFE_INTEGER' in Number ? Number.MAX_SAFE_INTEGER : 9007199254740991;

@@ -879,2 +910,2 @@

export { createSubContext, batch, attrs, styles, classes, merge, replace, reverse, round, striptags, number_format, format, title, url_encode, strtotime, random, min, max, cycle, attribute, isEmpty, inheritBlocks };
export { createSubContext, batch, attrs, styles, classes, merge, replace, reverse, round, striptags, number_format, format, title, url_encode, strtotime, trim, random, min, max, cycle, attribute, isEmpty, inheritBlocks };

@@ -768,2 +768,33 @@ 'use strict';

function trim(str, charList) {
var side = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'both';
if (charList === undefined && side === 'both') {
// Use String.prototype.trim() for efficiency
return String(str).trim();
}
if (side !== 'both' && side !== 'left' && side !== 'right') {
throw new Error('Filter "trim". Invalid value ' + side + ' for parameter "side". Valid values are "both", "left", "right".');
}
var strLen = str.length;
var trimStart = 0;
if (side === 'both' || side === 'left') {
while (trimStart < strLen && charList.indexOf(str[trimStart]) !== -1) {
trimStart++;
}
}
var trimEnd = strLen;
if (side === 'both' || side === 'right') {
while (trimEnd > 0 && charList.indexOf(str[trimEnd - 1]) !== -1) {
trimEnd--;
}
}
return str.substr(trimStart, trimEnd - trimStart);
}
var MAX_SAFE_INTEGER = 'MAX_SAFE_INTEGER' in Number ? Number.MAX_SAFE_INTEGER : 9007199254740991;

@@ -900,2 +931,3 @@

exports.strtotime = strtotime;
exports.trim = trim;
exports.random = random;

@@ -902,0 +934,0 @@ exports.min = min;

2

package.json
{
"name": "melody-runtime",
"version": "1.2.0-commit.33988325",
"version": "1.2.0-commit.10cb706c",
"description": "",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -964,1 +964,34 @@ /**

}
export function trim(str, charList, side = 'both') {
if (charList === undefined && side === 'both') {
// Use String.prototype.trim() for efficiency
return String(str).trim();
}
if (side !== 'both' && side !== 'left' && side !== 'right') {
throw new Error(
'Filter "trim". Invalid value ' +
side +
' for parameter "side". Valid values are "both", "left", "right".'
);
}
const strLen = str.length;
let trimStart = 0;
if (side === 'both' || side === 'left') {
while (trimStart < strLen && charList.indexOf(str[trimStart]) !== -1) {
trimStart++;
}
}
let trimEnd = strLen;
if (side === 'both' || side === 'right') {
while (trimEnd > 0 && charList.indexOf(str[trimEnd - 1]) !== -1) {
trimEnd--;
}
}
return str.substr(trimStart, trimEnd - trimStart);
}

@@ -32,4 +32,5 @@ /**

strtotime,
trim,
} from './filters';
export { random, min, max, cycle, attribute } from './functions';
export { isEmpty, inheritBlocks } from './helpers';
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