h2non / hu Goto Github PK
View Code? Open in Web Editor NEWSmall, generic functional helper library for node.js and browsers
License: MIT License
Small, generic functional helper library for node.js and browsers
License: MIT License
Create a macro for functional composition
Split common functions in types and misc
isFinite invalid:
TypeError: Cannot call method 'isFinite' of undefined
at Object.isFinite (/home/travis/build/h2non/hu/lib/type.js:49:24)
at Context.<anonymous> (undefined:100:17)
at callFn (/home/travis/build/h2non/hu/node_modules/mocha/lib/runnable.js:223:21)
at Test.Runnable.run (/home/travis/build/h2non/hu/node_modules/mocha/lib/runnable.js:214:7)
at Runner.runTest (/home/travis/build/h2non/hu/node_modules/mocha/lib/runner.js:374:10)
at Runner.runTests.next (/home/travis/build/h2non/hu/node_modules/mocha/lib/runner.js:452:12)
at next (/home/travis/build/h2non/hu/node_modules/mocha/lib/runner.js:299:14)
at Runner.hooks (/home/travis/build/h2non/hu/node_modules/mocha/lib/runner.js:309:7)
at next (/home/travis/build/h2non/hu/node_modules/mocha/lib/runner.js:247:23)
at Runner.hook (/home/travis/build/h2non/hu/node_modules/mocha/lib/runner.js:276:5)
at process.startup.processNextTick.process._tickCallback (node.js:245:9)
Add API usage code examples in ES6 and LiveScript
Add common maths function helpers
Add deep comparison utility functions
Add helper for function composition
It should add support for curry functions
Create macro for curry
Add support for is type for DOM nodes objects
Add recursive deep merge function
Add clean function that removes null nodes or elements of the given collection
Add memoize function
Add performance tests
Hi Mr h2non
I 've detected a bug in the debounce function
when I do
var createBonus = hu.debounce(function(){
console.log('creating boinus', bonuses.length);
bonuses.push(EL.getEntity('bonus',[canvas.width, Math.random() * (canvas.height - 39)]));
}, 5000);
the createBonus() function is used on a canvas game, then it's crucial that it's only being called after X seconds. Otherwise is called like 60 times per second.
What is happening right now is (on the game loop)
What should be happening is
If you are too busy, i can try to look into it this weekend, otherwise i will be very grateful for your fix
cheers
Add chain function
Add recurive deep object walk helper function
Add object
deep merging support
Add collection helper utility functions, like filter and map, which should also support arrays
Make functions support spread/rest arguments
(console.log (chars "123あいう🐜🐞🐝𤭢"))
ideal
[ '1', '2', '3', 'あ', 'い', 'う', '🐜', '🐞', '🐝', '𤭢' ]
reality
[ '1', '2', '3', 'あ', 'い', 'う', '�', '�', '�', '�', '�', '�', '�', '�' ]
Create macros for common code structures
In the transpiled js, due to the inclusion of the namespace (I don't know exactly why), it generates this output:
void 0;
void 0;
void 0;
void 0;
void 0;
void 0;
void 0;
void 0;
void 0;
Remove them or I kick the dog in my picture!
Add extend if property value is not empty
hu.extendIf({a: true}, {a: null}) // {a: true}
Add recursive deepClone function
Hi, maybe I missunderstood something, but I expected "curry" to work in other way
var hu = require('hu');
//HU CURRY SUM
var sum = hu.curry(function(a,b){
return a+b;
})
var mas2 = sum(2);
console.log(mas2(40));
console.log(mas2(50));
console.log(mas2(10));
//REAL CURRIED SUM
var sum2 = function(a){
return function(b){
return a+b;
}
}
var mas2_2 = sum2(2);
console.log(mas2_2(40));
console.log(mas2_2(50));
console.log(mas2_2(10));
And this is the result:
//HU
42
42
42
//REAL
42
52
12
hu.emptyObject() -> Object.create(null)
Add evil testing :P and more unit test coverage
hu must be based on pure functions and functional programming principles as much as possible
Investigate about guard functions
Add mocha & phantomjs tests support (also for Travis)
Add code examples in API docs
Add reduce function
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.