Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Utkarsh Sinha
    @liquidmetal
    babeljs.io down - do I need that for using trine?
    Utkarsh Sinha
    @liquidmetal
    okay - it isn't down.
    afilp
    @afilp
    Hi
    Just an ES6 modules question
    I use Babel and browserify for modules, but I would like to change all "require" to "import"
    So, I have this require inside the code:
    var test = require('./test');
    And inside test.js I have this:
    (function() {
    ...some code here...
    class myClass {
    ...more code here...
    }
        module.exports = new myClass();
    }).call(window);
    I changed the module.exports to export default new myClass();
    and the require to import('./test');
    But it does not work. Do I need some kind of polyfill?
    Jaeho Lee
    @sairion
    @af7 Babel gitter room would be more appropriate place to ask, but how does it fail?
    I don't think you need IIFE block to wrap after all
    afilp
    @afilp
    Thx @sairion
    Gorm Casper
    @casperin

    What's the easiest way to mess around with this library? If I want to be able to have a file like this:

    import map from 'trine/src/iterable/map'; // require is fine too
    console.log([1,2,3]::map(someFn));

    What's the compile step? ... Or am I doing it completely wrong?

    Gaetano Checinski
    @nikhedonia
    you could use babel-node --stage 0 --optional runtime myfile
    babel-runtime and babel-node must be installed in this case
    Gorm Casper
    @casperin
    Odd error: ReferenceError: The version of babel-runtime of undefined that you have installed does not match the babel version of 5.0.8 -- Pretty sure I just installed it babel-runtime@5.5.8
    Thanks though :)
    Jussi Kalliokoski
    @jussi-kalliokoski
    if you want to just mess around, I recommend creating a new directory, npm init there followed by npm i --save babel babel-runtime trine , then ./node_modules/.bin/babel-node --stage 0 myfile (--optional runtime shouldn't be required)
    I'm hoping to add a Trine-enabled Babel REPL to the website soon as well - that should enable "just messing around" type of trying out the library. :)
    btw, you should also import { map } from 'trine/iterable/map'; instead - trine exports things as named exports whereas the import foo from 'foo' syntax imports the default export of the 'foo' module under the identifier foo.
    Filip Stachura
    @filipstachura
    Hi guys! Is there any way to use trine in TypeScript?
    Jussi Kalliokoski
    @jussi-kalliokoski
    @filipstachura Hi Filip! Let's try and be as inclusive as possible and use gender neutral terms. :) Currently Trine doesn't expose the type definitions because TS / flow are lacking the possibility to annotate this other than automatically inside class declarations. However, with some tinkering you might be able to get Trine to work with TS, albeit AFAIK TS doesn't support the function bind syntax so the API will be quite awkward ( "babbca"::sortAlphabetically()::uniq()::head(2) vs head.call(uniq.call(sortAlphabetically.call("babbca")), 2) ). Maybe propose the function bind syntax to be added to TypeScript? ;)
    Barney Carroll
    @barneycarroll
    @jussi-kalliokoski just dropping in to say Trine has been an utter revelation for me
    So many Javascript APIs I've been struggling with for so long, I think I can fix, but then realise they're just fundamentally ugly because of language restrictions… and then data::arbitraryFn shows up. Genius. Fixes so much stuff, I hardly know where to start.
    :clap: