技术控

    今日:283| 主题:58107
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] simplify-string

[复制链接]
注定孤独一生 投递于 2016-10-5 13:01:19
134 1
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    simplifyStringto search with "some" kind of "more" fuzzy. It is especially interesting when u use firebase andwant to provide a full text search.  
  Installation

  1. $ npm i --save simplify-string
复制代码
Usage

  1. require("should");
  2. var simplifyString = require("simplify-string");
  3. describe("simplify-string", function () {
  4.   it("should simplify a string", function () {
  5.     simplifyString("üöäÜÖÄ").should.equal("uoauoa");
  6.     simplifyString("andrè").should.equal("andre");
  7.     simplifyString("a ûnîcôrn likes honey").should.equal("aunicornlikeshoney");
  8.   });
  9. });
复制代码
License

  MIT ©s-a



上一篇:戴尔-EMC“力挺”华为打造的开源管理颠覆性方案
下一篇:High-performance Computing with Amazon’s X1 Instance
林莎 投递于 2016-10-9 02:30:46
只吃楼主,撸过过经验,小伙伴们都惊呆了
回复 支持 反对

使用道具 举报

我要投稿

推荐阅读


回页顶回复上一篇下一篇回列表
手机版/CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 | 粤公网安备 44010402000842号 )

© 2001-2017 Comsenz Inc.

返回顶部 返回列表