npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@marcg68/nondiacritic

v1.1.16

Published

Replace diacritic characters with non-diacritic equivalent(s)

Downloads

1

Readme

Remove diacritics from a string

Usage

CommonJS

const diac = require('@marcg68/nondiacritic')

const str = 'Über ähnlich'

console.log(diac.removeDiacritics(str))

console.log(diac.removeDiacritics(str, { ucfirst: true }))

outputs

{ original: 'Über ähnlich', replaced: 'UEber aehnlich' }
{ original: 'Über ähnlich', replaced: 'Ueber aehnlich' }

ES6

import { removeDiacritics } from '@marcg68/nondiacritic'

const str = 'Über ähnlich'

console.log(removeDiacritics(str))

outputs

{ original: 'Über ähnlich', replaced: 'UEber aehnlich' }

Intro

Based on https://github.com/andrewrk/node-diacritics/

Refs

  • https://whitep4nth3r.com/blog/how-to-build-test-and-release-node-module-es6/
  • https://github.com/whitep4nth3r/random-code/blob/main/src/index.js
  • https://medium.com/swlh/how-to-publish-an-es6-module-to-npm-43dda8aabbf
  • https://medium.com/@alexishevia/the-magic-behind-npm-link-d94dcb3a81af

Setup

Using npm

npm init --scope=@marcg68
npm install --save-dev babel-cli babel-preset-es2015

Write the code in src/index.js, with the following single code line in the entry point app.js:

module.exports = require('./dist')

Add "build": "babel src -d dist"

to top level "scripts" key in package.json, which when

npm run build

is run, will compile the src and place into dist.

Testing

npm link # allows the module to be loaded from anywhere on the same machine

In a another directory on the same box, initialise a project with npm and link the module.

npm init -y
npm link @marcg68/nondiacritic

On the commandline:

node -e ';(async () => console.log((await import("@marcg68/nondiacritic")).removeDiacritics("Über ähnlich")))()'

should output:

{ original: 'Über ähnlich', replaced: 'UEber aehnlich' }

Publishing

npm publish --access public