πΊ Zero-dependency Map and RegExp based string replacer with Unicode support. π
I work hard for every project, including this one and your support means a lot to me!
Consider buying me a coffee. β
Thank you for supporting my efforts! ππ
![]()
@igorskyflyer
Install it by executing:
npm i "@igor.dvlpr/mapped-replacer"
Adds a new rule or updates the existing rule for character replacing.
import { MappedReplacer } from '@igor.dvlpr/mapped-replacer'
const mapper: MappedReplacer = new MappedReplacer()
mapper.addRule(':smile:', 'π')
console.log(mapper.replace('Hello world :smile:')) // outputs 'Hello world π'
Adds rules or updates the existing rules for character replacing. Passed object is a simple key-value object, i.e. { '<': '<', '>': '>'}
import { MappedReplacer } from '@igor.dvlpr/mapped-replacer'
const mapper: MappedReplacer = new MappedReplacer()
mapper.addRules({
'π': '𝕋',
'β': '≈',
'π±': '𝔱',
})
console.log(mapper.replace('π β π±')) // outputs '𝕋 ≈ 𝔱'
Removes the rule that matches the provided key.
import { MappedReplacer } from '@igor.dvlpr/mapped-replacer'
const mapper: MappedReplacer = new MappedReplacer()
mapper.addRule('π', '𝕋')
mapper.addRule('β', '≈')
mapper.removeRule('π')
console.log(mapper.replace('π β π±')) // outputs 'π ≈ π±'
Gets the number of rules for character replacing.
import { MappedReplacer } from '@igor.dvlpr/mapped-replacer'
const mapper: MappedReplacer = new MappedReplacer()
mapper.addRule('π', '𝕋')
console.log(mapper.rulesCount()) // outputs 1
Clears all the rules.
import { MappedReplacer } from '@igor.dvlpr/mapped-replacer'
const mapper: MappedReplacer = new MappedReplacer()
mapper.addRule('π', '𝕋')
mapper.clearRules()
console.log(mapper.rulesCount()) // outputs 0
Replaces the values in the input that match the keys in the Map object.
import { MappedReplacer } from '@igor.dvlpr/mapped-replacer'
const mapper: MappedReplacer = new MappedReplacer()
mapper.addRule('β', '→')
console.log(mapper.replace('a β b')) // outputs 'a → b'
Licensed under the MIT license which is available here, MIT license.
π§ Zep is a zero-dependency, efficient debounce module. β°
π₯ Removes HTML code from the given string. Can even extract text-only from the given an HTML string. β¨
πͺ A Node.js module for reading the AppPaths registry key on Windows. Useful for retrieving applications that can be launched from the command prompt. π
@igor.dvlpr/adblock-filter-counter
π² A dead simple npm module that counts Adblock filter rules.π¦
π₯½ Provides ways of parsing UNC paths and checking whether they are valid. π±
Provided by Igor DimitrijeviΔ (@igorskyflyer).