simplify-string
v1.0.3
Published
Create a primitive representation of a string
Downloads
255
Readme
simplify-string
Create a primitive representation of a string
I use this lib in browser and in node. The goal is to remove all special chars from a string for different use cases. Create a human readable or SEO url tag from string. Create filenames and much more. I personally use it to create search index from strings and search user input strings from GUI passed through simplifyString
to search with "some" kind of "more" fuzzy. It is especially interesting when u use firebase andwant to provide a full text search.
Installation
$ npm i --save simplify-string
Usage
require("should");
var simplifyString = require("simplify-string");
describe("simplify-string", function () {
it("should simplify a string", function () {
simplifyString("üöäÜÖÄ").should.equal("uoauoa");
simplifyString("andrè").should.equal("andre");
simplifyString("a ûnîcôrn likes honey").should.equal("aunicornlikeshoney");
});
});
License
MIT © s-a