Skip to content

szilveszter9/smallfoot.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Smallfoot.js

Description

Smallfoot.js is a minimalist library for functional programming, with small footprint.

Github

https://github.com/szilveszter9/smallfoot.js

Examples

var app = l.compose(
  l.log.value,
  l.string.upper,
  l.object.getValue('innerHTML'),
  l.dom.getDomElement
);

app('#mydiv');
  • Request JSON data and inject it into a template. (Read the compose from right to left.)
var userTemplate = l.template.set('<div class="avatar">{{login}}<img src="{{avatar_url}}"/></div>');
var url = "https://api.github.com/repos/mozilla/kuma/contributors";
var userTemplates = l.compose(l.map(userTemplate), l.http.getResponseJSON);
var usersTemplate = l.compose(l.array.toString, userTemplates);
var eitherUsersTemplate = l.compose(l.Either('could not generate the template'), l.array.toString, userTemplates);
function app(){
  var setMydiv = getElSetHtml('#mydiv');
  var showUsers = l.compose(l.map(setMydiv), eitherUsersTemplate);
  l.http.get(showUsers)(url)();
}

app();

NPM

https://www.npmjs.com/package/smallfoot

Installation

npm install smallfoot

Build distribution

npm run dist

Contribution

Bug fixes, docs and examples are welcomed.

You can start with smallfoot-sandbox, see https://github.com/szilveszter9/smallfoot-sandbox

git clone https://github.com/szilveszter9/smallfoot.js
git clone https://github.com/szilveszter9/smallfoot-sandbox
cd smallfoot-sandbox
npm install
npm link ../smallfoot.js
npm run dev
npm start

About

Smallfoot.js is a minimalist library for functional programming, with small footprint.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published