1

I need to remove diacritics from string in emberjs app. I found a plugin for this: fold-to-ascii but I don't know how to use it in my app.

I added this plugin via npm and it is visible under node_modules folder in my app

In docs usage of this plugin is:

var foldToAscii = require("fold-to-ascii");
foldToAscii.fold("★Lorém ïpsum dölor.")

but i get an exception:

Uncaught Error: Could not find module fold-to-ascii

also tried importing it like @Kori John Roys suggested:

import foldToAscii from 'fold-to-ascii'

but it gives me only new exception:

Error while processing route: transports.index Could not find module fold-to-ascii imported from test-ember/pods/transport/model

What am I doing wrong ?

1 Answer 1

5

Assuming you are using ember-cli:

npm install --save-dev ember-browserify

then you can import like this:

import foldToAscii from "npm:fold-to-ascii"
Sign up to request clarification or add additional context in comments.

2 Comments

tried it and now I get error: Error while processing route: transports.index Could not find module fold-to-ascii imported from test-ember/pods/transport/model Error: Could not find module fold-to-ascii imported from test-ember/pods/transport/model, should I point import to node_modules folder ?
ah yes, you're right sorry. You'll want to npm install --save-dev ember-browserify, then import foldToAscii from "npm:fold-to-ascii"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.