jonschlinkert / ends-with

Return `true` if a string ends with the given characters.
MIT License
8 stars 0 forks source link

Not compatible with ES6 import #4

Closed Gouigouix closed 7 years ago

Gouigouix commented 7 years ago

Hello,

I tried to run your library with ES6 import

import {endsWith} from "ends-with";
if (endsWith (href, "#") {
     ...
}

I have the following error:

Uncaught TypeError: ends_with_1.endsWith is not a function
    at cleanUrl (orxapi.widgets.testbyfamily.min.js:7001)
    at Object.getUrlVar (orxapi.widgets.testbyfamily.min.js:6915)
    at MessageForm.handleSubmitMessage (orxapi.widgets.testbyfamily.min.js:259)
    at Object.Ia (orxapi.widgets.testbyfamily.min.js:1535)
    at Object.invokeGuardedCallback (orxapi.widgets.testbyfamily.min.js:1505)
    at Object.invokeGuardedCallbackAndCatchFirstError (orxapi.widgets.testbyfamily.min.js:1508)
    at Ya (orxapi.widgets.testbyfamily.min.js:1607)
    at bb (orxapi.widgets.testbyfamily.min.js:1636)
    at db (orxapi.widgets.testbyfamily.min.js:1646)
    at Array.forEach (<anonymous>)

Thank you.

doowb commented 7 years ago

did you try either of the following statements?

import endsWith from 'ends-with';

or

import * as endsWith from 'ends-with'

You can find more information on the import statement here