string-replace-all
Advanced tools
Comparing version 1.0.3 to 2.0.0
@@ -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; |
@@ -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
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
1
3
Yes
3511
31
2
1
+ Addedstring-escape-regex@^1.0.0
+ Addedstring-escape-regex@1.0.1(transitive)
- Removed@types/lodash@^4.14.58
- Removedlodash@^4.17.4
- Removed@types/lodash@4.17.15(transitive)
- Removedlodash@4.17.21(transitive)