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

@ribajs/utils

Package Overview
Dependencies
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ribajs/utils - npm Package Compare versions

Comparing version 1.9.0-beta.1 to 1.9.0-beta.2

dist/browser.d.ts

25

package.json
{
"name": "@ribajs/utils",
"description": "Utils module of Riba.js",
"version": "1.9.0-beta.1",
"version": "1.9.0-beta.2",
"author": "Pascal Garber <pascal@artandcode.studio>",

@@ -35,3 +35,12 @@ "contributors": [

],
"scripts": {},
"scripts": {
"lint": "eslint src --ext .js,.jsx,.ts,.tsx --fix && tsc --noEmit",
"build": "npm run lint && tsc",
"build:ts": "npm run lint",
"clean": "rm -rf ./dist ./lib"
},
"files": [
"/src",
"/dist"
],
"bugs": {

@@ -43,7 +52,11 @@ "url": "https://github.com/ribajs/riba/issues"

"devDependencies": {
"@babel/runtime": "^7.11.2",
"@babel/runtime-corejs3": "^7.11.2",
"@ribajs/tsconfig": "1.9.0-beta.1",
"babel-jest": "^26.3.0"
"@babel/runtime": "^7.12.0",
"@babel/runtime-corejs3": "^7.12.0",
"@ribajs/eslint-config": "1.9.0-beta.2",
"@ribajs/tsconfig": "1.9.0-beta.2",
"@types/jest": "^26.0.14",
"babel-jest": "^26.5.2",
"eslint": "^7.11.0",
"typescript": "^4.0.3"
}
}

@@ -169,2 +169,36 @@ export const couldBeJson = (str?: string | null) => {

/**
* Remove all special chars from a string
* @see https://stackoverflow.com/a/11090301/1465919
* @param str
*/
const withoutSpecialChars = (str: string) => {
// str = str.replace(/[^\w\s]/gi, ""); // http://stackoverflow.com/a/4374890
str = str.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>{}[\]\\/]/gi, "");
return str;
};
/**
* Removes multiple tabs, newlines, etc from a string
* @param str
*/
const withoutMultiWhitespace = (str: string) => {
str = str.replace(/\s\s+/g, " ");
return str;
};
/**
* Formats a string into a handle.
* E.g. '100% M & Ms!!!' -> 100-m-ms
* @see https://help.shopify.com/themes/liquid/filters/string-filters#handle-handleize
*/
export const handleize = (str: string) => {
str = str.trim();
str = withoutMultiWhitespace(str);
str = withoutSpecialChars(str);
str = str.toLowerCase();
str = str.replace(/ /g, "-");
return str;
};
export const stripHtml = (html: string) => {

@@ -171,0 +205,0 @@ const tmp = document.createElement("DIV");

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