Giter VIP home page Giter VIP logo

core-lib's People

Contributors

hasclass avatar jastix avatar jeanlange avatar kossnocorp avatar mhart avatar sixeight avatar tobiaszcudnik avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

core-lib's Issues

Example from the main page isn't working because of missing size

Example from the main page isn't working because of missing size method, all in 'god mode'. Code:

R.god_mode('')
"kampai".ljust(10, ' ') // => '  kampai  '
  .size() // 10
  .times(function(i) { console.log(i)} )

After some shallow debugging I suspect RWrapper to mess around with it.

BTW what's the point of these lines:

_str = R._str = (str) ->
  new RWrapper(str, _str)

It seems they will be executed each time I create a string and because of the outer scope it'll be nested one level deeper every time. Am i missing something?

Objects as R.Hash keys

Exciting stuff. This library looks like a great aid for using a familiar standard library to learn an unfamiliar language and execution model.

Is an R.Hash expected to support object keys at this time? For me, an R.Hash behaves like a JavaScript Object:

require 'rubyjs'

a = {name: 'a'}
b = {name: 'b'}

h = R.Hash.new
h[a] = 'value of h[a]'
h[b] = 'value of h[b]'

console.log "a == b?", a is b # => a == b? false
console.log h[a] # => value of h[b]
console.log h[b] # => value of h[b]

Perhaps I was supposed to implement a hashcode function on a and b?

Array#shuffle strange behavior

R([1, 5, 3, 5, 5]).shuffle()

=> Array {native: Array[5], constructor: function, all: function, any: function, collect_concat: function…}
native: Array[5]
0: 1
1: 5
2: 5
3: 5
4: 5
length: 5
proto: Array[0]
proto:

_a.shuffle([1,2,3,4,5])
=> [1, 5, 3, 5, 5]

thank you

Node support

Provide rubyjs as a npm module, so features can be used in nodejs on the server side

God mode's override set to true and a stack overflow

When using the 'god mode' with override set to true i've got a stack overflow. Code to reproduce (CS)

{ R } = require('rubyjs')

R.god_mode '', yes

test = "kampai".ljust(10, ' ')

Result:

.../node_modules/rubyjs/ruby.js:83
      val = this.valueOf();
                 ^
RangeError: Maximum call stack size exceeded

Javascript heap out of memory

Running on Ubuntu 16:

> coffee -v
CoffeeScript version 1.11.1
> node -v
v6.7.0
> uname -r
4.4.0-47-generic

The lib version:

"rubyjs": "^0.7.2"

I haven't seen this error before. Running R("foo") after require 'rubyjs' causes it:

coffee> R("foo")

<--- Last few GCs --->

   45830 ms: Mark-sweep 1329.4 (1404.5) -> 1332.6 (1404.5) MB, 12.6 / 0.0 ms [allocation failure] [GC in old space requested].
   45842 ms: Mark-sweep 1332.6 (1404.5) -> 1336.0 (1404.5) MB, 12.2 / 0.0 ms [allocation failure] [GC in old space requested].
   45855 ms: Mark-sweep 1336.0 (1404.5) -> 1346.9 (1403.5) MB, 12.6 / 0.0 ms [last resort gc].
   45868 ms: Mark-sweep 1346.9 (1403.5) -> 1357.8 (1403.5) MB, 13.1 / 0.0 ms [last resort gc].


<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x177c2fdcfb51 <JS Object>
    1: [Symbol.replace] [native regexp.js:~540] [pc=0x3d45e7b30436] (this=0x3c130ea933d9 <JS RegExp>,D=0x20328707c8b9 <Very long string[2584059]>,aw=0x298a5742ea79 <String[2]: \f>)
    2: 0x177c2fd8aaf1 <Symbol: 20329980 <String[14]: Symbol.replace>>(aka [Symbol.replace]) [native regexp.js:677] [pc=0x3d45e7b59f4a] (this=0x3c130ea933d9 <JS RegExp>,D=0x20328707c8b9 <Very long string[2584059]>,aw=...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
 1: node::Abort() [node]
 2: 0x10d3d2c [node]
 3: v8::Utils::ReportApiFailure(char const*, char const*) [node]
 4: v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) [node]
 5: v8::internal::Factory::NewRawOneByteString(int, v8::internal::PretenureFlag) [node]
 6: v8::internal::String::SlowFlatten(v8::internal::Handle<v8::internal::ConsString>, v8::internal::PretenureFlag) [node]
 7: v8::internal::Runtime_StringReplaceGlobalRegExpWithString(int, v8::internal::Object**, v8::internal::Isolate*) [node]
 8: 0x3d45e78092a7
fish: “coffee” terminated by signal SIGABRT (Abort)

Array#min bug

_a.min [16, 14, 12, 11, 9, 7, 6, 4, 2, 0, 1, 3, 5, 6, 8, 10, 12, 13]
= > null
R([16, 14, 12, 11, 9, 7, 6, 4, 2, 0, 1, 3, 5, 6, 8, 10, 12, 13]).min()
=> null

am i missing something?

thank you

Array Enumeration do not work as excepted when modifying input

This is probably unfixable until Proxies are out.

a = [1,2,3]
R(a).each(function(n){
  console.log(n)
  a.splice(a.indexOf(n), 1)
})
// > 1
// > 3

The input array is not copied and modifications to the array produce unexpected results. Perhaps the README.md could illustrate this behaviour and how modifying an input array is a bad idea.

Perhaps something could be logged when the length of an input array changes between yields.

I solved this with a simple .reject.

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.