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

string-replace-all

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-replace-all - npm Package Compare versions

Comparing version 1.0.3 to 2.0.0

license

10

dist/index.d.ts

@@ -1,8 +0,2 @@

declare function stringReplaceAll(str: string, find: string, replacement: string): string;
declare const _default: typeof stringReplaceAll & {
default: typeof stringReplaceAll;
}
declare namespace _default {
export type type = typeof stringReplaceAll;
}
export = _default;
declare const replaceAll: (str: string, find: string, replacement: string) => string;
export default replaceAll;

16

dist/index.js

@@ -1,12 +0,8 @@

"use strict";
/* IMPORT */
var escapeRegExp = require("lodash/escapeRegExp");
/* STRING REPLACE ALL */
function stringReplaceAll(str, find, replacement) {
return str.replace(new RegExp(escapeRegExp(find), 'g'), replacement);
}
import escape from 'string-escape-regex';
/* MAIN */
const replaceAll = (str, find, replacement) => {
return str.replace(new RegExp(escape(find), 'g'), replacement);
};
/* EXPORT */
module.exports = stringReplaceAll;
module.exports.default = stringReplaceAll;
Object.defineProperty(module.exports, "__esModule", { value: true });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUNBLFlBQVk7O0FBRVosa0RBQXdEO0FBRXhELHdCQUF3QjtBQUV4QixTQUFTLGdCQUFnQixDQUFHLEdBQVcsRUFBRSxJQUFZLEVBQUUsV0FBbUI7SUFFeEUsT0FBTyxHQUFHLENBQUMsT0FBTyxDQUFHLElBQUksTUFBTSxDQUFHLFlBQVksQ0FBRyxJQUFJLENBQUUsRUFBRSxHQUFHLENBQUUsRUFBRSxXQUFXLENBQUUsQ0FBQztBQUVoRixDQUFDO0FBRUQsWUFBWTtBQUVaLGtCQUFlLGdCQUFnQixDQUFDIn0=
export default replaceAll;
{
"name": "string-replace-all",
"version": "1.0.3",
"repository": "github:fabiospampinato/string-replace-all",
"description": "Replaces all the occurrences of a string into a string with another string.",
"version": "2.0.0",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"exports": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"clean:dist": "rimraf dist",
"clean:coverage": "rimraf coverage .nyc_output",
"clean": "npm run clean:dist && npm run clean:coverage",
"compile": "tsc --skipLibCheck && tstei",
"compile:watch": "tsc --skipLibCheck --watch",
"test": "ava",
"test:watch": "ava --watch",
"coverage": "nyc --reporter=html ava",
"report": "nyc report",
"report:html": "open coverage/index.html",
"prepublishOnly": "npm run clean && npm run compile && npm run coverage"
"clean": "tsex clean",
"compile": "tsex compile",
"compile:watch": "tsex compile --watch",
"test": "tsex test",
"test:watch": "tsex test --watch",
"prepublishOnly": "npm run clean && npm run compile && npm run test"
},
"ava": {
"files": [
"test/index.js"
]
},
"bugs": {
"url": "https://github.com/fabiospampinato/string-replace-all/issues"
},
"license": "MIT",
"author": {
"name": "Fabio Spampinato",
"email": "spampinabio@gmail.com"
},
"repository": {
"type": "git",
"url": "https://github.com/fabiospampinato/string-replace-all.git"
},
"keywords": [

@@ -43,13 +24,9 @@ "string",

"dependencies": {
"@types/lodash": "^4.14.58",
"lodash": "^4.17.4"
"string-escape-regex": "^1.0.0"
},
"devDependencies": {
"ava": "^0.18.2",
"ava-spec": "^1.1.0",
"nyc": "^10.1.2",
"rimraf": "^2.6.0",
"typescript": "~3.0.3",
"typescript-transform-export-interop": "^1.0.0"
"fava": "^0.0.6",
"tsex": "^1.1.2",
"typescript": "^4.6.4"
}
}
/* IMPORT */
import escapeRegExp = require ( 'lodash/escapeRegExp' );
import escape from 'string-escape-regex';
/* STRING REPLACE ALL */
/* MAIN */
function stringReplaceAll ( str: string, find: string, replacement: string ): string {
const replaceAll = ( str: string, find: string, replacement: string ): string => {
return str.replace ( new RegExp ( escapeRegExp ( find ), 'g' ), replacement );
return str.replace ( new RegExp ( escape ( find ), 'g' ), replacement );
}
};
/* EXPORT */
export default stringReplaceAll;
export default replaceAll;
/* IMPORT */
import {describe} from 'ava-spec';
import stringReplaceAll from '../dist';
import {describe} from 'fava';
import stringReplaceAll from '../dist/index.js';
/* STRING REPLACE ALL */
/* MAIN */

@@ -9,0 +9,0 @@ describe ( 'stringReplaceAll', it => {

{
"compilerOptions": {
"alwaysStrict": true,
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"inlineSourceMap": true,
"lib": ["dom", "scripthost", "es2015", "es2016", "es2017"],
"module": "commonjs",
"moduleResolution": "node",
"newLine": "LF",
"noFallthroughCasesInSwitch": true,
"noImplicitReturns": true,
"noUnusedLocals": true,
"noUnusedParameters": false,
"outDir": "dist",
"pretty": true,
"strictNullChecks": true,
"target": "es5"
},
"include": [
"src"
],
"exclude": [
"node_modules"
]
"extends": "tsex/tsconfig.json"
}

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