safe-trim
trim sting and remove zero-width-space in content
Last updated 9 months ago by haozime .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install safe-trim 
SYNC missed versions from official npm registry.

safe-trim


Build Status codecov dependencies Status devDependencies Status

install

npm install safe-trim

use

import safeTrim from 'safe-trim'
safeTrim('    a      b  ')

remove Invisible spaces

let str = '  "a":1    a \r\n\r\t  ᠎              b       '
let ret = safeTrim(str)
expect(ret).toEqual('"a":1    a\n\nb')

convert CR CR-LR into LR

a\r\n\r\nb  => 'a\n\nb'
a\r\rb => 'a\n\nb'
a\r\r\nb => 'a\n\nb'

remove BOM

JSON.parse('{"a":1}') // ❗️Error because BOM

JSON.parse(safeTrim('{"a":1}')) // ✅

more feature

more feature

Current Tags

  • 1.1.0                                ...           latest (9 months ago)

17 Versions

  • 1.1.0                                ...           9 months ago
  • 1.0.15                                ...           9 months ago
  • 1.0.14                                ...           2 years ago
  • 1.0.13                                ...           2 years ago
  • 1.0.12                                ...           3 years ago
  • 1.0.11                                ...           3 years ago
  • 1.0.10                                ...           3 years ago
  • 1.0.9                                ...           3 years ago
  • 1.0.8                                ...           3 years ago
  • 1.0.7                                ...           3 years ago
  • 1.0.6                                ...           3 years ago
  • 1.0.5                                ...           3 years ago
  • 1.0.4                                ...           3 years ago
  • 1.0.3                                ...           3 years ago
  • 1.0.2                                ...           3 years ago
  • 1.0.1                                ...           3 years ago
  • 1.0.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 9
Dependencies (0)
None
Dependents (1)

Copyright 2014 - 2016 © taobao.org |