Giter VIP home page Giter VIP logo

Comments (7)

zikes avatar zikes commented on July 28, 2024

One potential solution, and one that I think would be preferable to browserify and create a more compact file, would be to write a node.js script that simply does a require and then writes a JSON.stringify() export into an output file preceded by a var numbers =

from numbers.js.

zikes avatar zikes commented on July 28, 2024

After running a few tests I can see it's not quite so easy, unfortunately. Running JSON.stringify on something that's been required only returns an empty object.

from numbers.js.

sjkaliski avatar sjkaliski commented on July 28, 2024

@zikes let's see how other libraries are doing this.

from numbers.js.

zikes avatar zikes commented on July 28, 2024

The multiplatform libraries I could find used various techniques to read the individual files and combine them as strings. I made a barebones example at https://github.com/Zikes/multiplatform that we could use. Each individual component can still be required in node.js, but the library itself ends up being a single file in public/ that can be included in either node.js or the browser. To build, run node build.js.

from numbers.js.

kagarwala avatar kagarwala commented on July 28, 2024

Hi,
i ran into this issue while using numbers.js in my sencha touch project...
I exposed the 'require' function from browserify into global scope...then I could use 'require("numbers.js")'...
Not sure is this the correct way...But took me 2 days to get this thing working in my project...:(

@ sjkaliski ...
there might be a bug in simple matrix addition..
var array1 = [0, 1, 2];

the expected arg was = var array1 = [[0], [1], [2]];

from numbers.js.

LarryBattle avatar LarryBattle commented on July 28, 2024

@kagarwala That doesn't seem like a bug. I didn't write the code but the matrix object has multiple functions dealing with vectors. My assumption is that instead of writing two functions for matrix and vector addition and subtraction, the author decided to combine functionality.
Test cases here: https://github.com/sjkaliski/numbers.js/blob/master/test/matrix.test.js#L59

from numbers.js.

LarryBattle avatar LarryBattle commented on July 28, 2024

This issue is resolved with the pull request #118

from numbers.js.

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.