GithubHelp home page GithubHelp logo

Comments (7)

crudh avatar crudh commented on June 21, 2024

@alesch: Does it work if you do: import I from 'seamless-immutable'?

from seamless-immutable.

alesch avatar alesch commented on June 21, 2024

Using new it works, but it is ugly:

import I from 'seamless-immutable'

let l = new I([1,2,3]);
console.log(l);   // [ 1, 2, 3 ]

When using Ramda I do: import * as R from 'ramda' and it exposes all its functions under R.
I guess the difference is that seamless is not exposing a namespace, but a function.

from seamless-immutable.

crudh avatar crudh commented on June 21, 2024

I'm using babel and browserify and the following works for me:

import I from "seamless-immutable";

const l = I([1, 2, 3]);
console.log(l);   // [1, 2, 3, __immutable_invariants_hold: true]

from seamless-immutable.

alesch avatar alesch commented on June 21, 2024

You are right, it works for me too with node. It was my IDE's linter complaining ?!?

In the beginning I tried using nesh, and there import I from ... does not work. But a regular require does.

Sorry about that and thanks for your help!

from seamless-immutable.

crudh avatar crudh commented on June 21, 2024

@alesch: nice! my IDE complains also if I do:
import I from "seamless-immutable";
but if I do:
import immutable from "seamless-immutable";
it doesnt. It's because functions with a name that starts with an uppercase letter are supposed to be constructor functions and used with new.

from seamless-immutable.

alesch avatar alesch commented on June 21, 2024

Super!

from seamless-immutable.

jbmeslin avatar jbmeslin commented on June 21, 2024

Hi,

how replace a require('seamless-immutable').static with and ES6 import ?

from seamless-immutable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.