Giter VIP home page Giter VIP logo

dom-word-replacer's Introduction

Hi there ๐Ÿ‘‹ I'm mooeypoo and I love open source software

I do random things and have a lot of really weird repos, some of which I wrote a long time ago, either for experimentation, learning, or some open source gadgets and plugins for open source tools.

dom-word-replacer's People

Contributors

mooeypoo avatar

Stargazers

 avatar

Watchers

 avatar  avatar

dom-word-replacer's Issues

Produce a proper README with snippets and proper explanation about the replace options

The readme right now is a big messy, and tries to explain about the general concepts alongside the technical options/config.

There are a few concepts that require explanation:

  • Dictionaries and the expected structure, nuances of "ambiguous" terms, random choice from multiple replacement options, groupings, etc.
  • Installation and usage examples
  • Config options for instantiation
  • Option object for the replacement method

There should be an organized README with, potentially, some wiki pages to delve deeper into usage examples and explanations without overwhelming the page completely.

Add 'suggestion' mode, which does not replace words

Add a mode that goes over matches but does not replace them -- instead, provides the available replacement suggestions in a data-suggested-replacements (or similar) prop.

The goal:

Analyzing web pages and tagging/flagging words that should or could be considered for replacement, and providing available options, allowing consumers to create a popup or hover that provides explanation and suggestion.

Probably depends on #1 - Since this adds yet another parameter to the .replace(...) call, also consider making the optional configuration inside a config variable (which would be a breaking change).

Use a configuration object for optional parameters in `replace` call

The replace method is starting to be extremely verbose in terms of the parameters it allows, and there are several future enhancement considerations that may add even more to it.

The call should be replaced to have the optional parameters as part of a configuration options object, which will also allow for more flexibility in the future.

Instead of

replacer.replace(htmlString, keyFrom, keyTo,baseUrl, bothWays);

It should be something like

replacer.replace(html, this.keys[0], this.keys[1], {
  baseUrl: '...',
  bothWays: '...'
});

And then include other upcoming modes.

Consolidate benchmark performance tests

There are currently benchmarking of performance done in the demos folder, but these should be made into actual tests with proper performance benchmarking to make sure the operation doesn't take an unreasonable amount of time.

When replacing a word, keep the original case

Replacing words should result with the same casing (in English, at least). Foo replaced with Bar rather than bar.

Since replacements aren't necessarily the same amount of letters, there are really only two cases the system should keep case for:

  • Capitalization of first letter (Foo -> Bar)
  • Capitalization of the entire word (FOO -> BAR)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.