Modular JavaScript Utilities

Overview

mout

http://moutjs.com/

Build Status Downloads Version

All code is library agnostic and consist mostly of helper methods that aren't directly related with the DOM, the purpose of this library isn't to replace Dojo, jQuery, YUI, Mootools, etc, but to provide modular solutions for common problems that aren't solved by most of them. Consider it as a crossbrowser JavaScript standard library.

Main goals

  • increase code reuse;
  • be clear (code should be clean/readable);
  • be easy to debug;
  • be easy to maintain;
  • follow best practices;
  • follow standards when possible;
  • don't convert JavaScript into another language!
  • be compatible with other frameworks;
  • be modular;
  • have unit tests for all modules;
  • work on multiple environments (IE7+, modern browsers, node.js);

What shouldn't be here

  • UI components;
  • CSS selector engine;
  • Event system - pub/sub;
  • Template engine;
  • Anything that isn't generic enough to be on a standard library;
  • Anything that could be a separate library and/or isn't a modular utility...

API Documentation

Online documentation can be found at http://moutjs.com/ or inside the doc folder.

FAQ / Wiki / IRC

For more info about project structure, design decisions, tips, how to contribute, build system, etc, please check the project wiki.

We also have an IRC channel #moutjs on irc.freenode.net

License

Released under the MIT License.

Comments
  • Propose: function/delay

    Propose: function/delay

    Delay's are something I come across a lot in Front End development and I find JavaScripts setTimeout syntax rather cumbersome, especially when it comes to executing function within a certain context and arguments.

    I wrote and tested this little helper delay( fn, millis, context, [...args] ) : Number. It returns the identifier from the timeout (e.g. var identifier = setTimeout( ...) that can be used to cancel the delay.

    Now, I am not sure if that is part of the targeted field of mout this is why I consider it a proposal.

    Let me know what you think.

    PS: I tried to keep the JavaScript style as closely to what I saw in mout so far. Refactors are always welcome.

    feature 
    opened by roboshoes 58
  • Convert to ES Modules

    Convert to ES Modules

    As per #245.

    This is inital conversion effort.

    Couple of notes:

    • ~~Certain tests had to be modified to support strict mode.~~
    • ~~There are couple of tests that are failing so those should be updated.~~
    • Currently tests are running only in Node, so browser testing should be added (maybe via Karma?).
    • There’s still no process of creating CommonJS files from ESM files, but it shouldn’t be too hard to add that.
    • ~~Named exports should be added where appropriate.~~
    • ~~Add module as side-effect free (sideEffects: false in package.json)~~
    • ~~As final touch, little housekeeping could be added with ESLint, Prettier, Git commit hooks, …~~
    • ~~Automatic ES5 to ES6 convert via Lebab?~~
    • What should be default consuming format, ESM or CJS?
      • If it’s ESM, CJS is available through const math = require('mout/cjs/math);
      • If it’s CJS, ESM is available through import math from 'mout/esm/math;

    /cc @roboshoes @millermedeiros

    opened by niksy 44
  • add random/randBool

    add random/randBool

    since this is very common and is way clearer than using choice(true, false) or using randBit() for the same effect.

    also add option to override the mockRandom values.

    feature 
    opened by millermedeiros 20
  • reuse lodash methods?

    reuse lodash methods?

    I was talking with @conradz on IRC today and this came up.

    Since [email protected] have a modular build we have the option to delegate some of our methods to lodash (or maybe remove them from mout).

    PS: I'm not sure how that would impact current projects (if the RequireJS "map" config and/or "proxy modules" would be enough) and how different some of the implementations really are.

    question wontfix 
    opened by millermedeiros 14
  • create a build command to export packages as globals

    create a build command to export packages as globals

    sometimes it can be good for quick prototyping / testing on the console and some users might not be using AMD or browserify...

    I'm thinking in some very quick-and-dirty solution that basically reuses the requirejs optimizer and maybe bundles the code with some very basic AMD shim

      export [packageName] [globalNamespace]
      export the given package or whole lib into the namespace (default to mout.{packageName}) 
    

    /cc @edankwan

    feature task 
    opened by millermedeiros 13
  • add new indexOf() method that works similar to find()

    add new indexOf() method that works similar to find()

    in some cases it is useful to grab the index of an element based on a given key/value pair, something like findIndex(arr, {id:'foo'}).

    a good use case for it is when you have 2 separate arrays/data-structures and you need to grab an element in one array based on the items of another, or maybe you have something else that is index based (eg. pagination).

    for the case above you can do a naive implementation like indexOf(pluck(arr, 'id'), 'foo'); but performance won't be that great since it requires 2 loops and constructing a temporary array just to grab the index, a better implementation would be something like find() but that returns the index instead of the value (both implementations could even be merged).

    /cc @edankwan

    feature 
    opened by millermedeiros 13
  • Some new methods.

    Some new methods.

    Hey these are some methods that i've used along side with mout and wish it had.

    result is just some simple syntax sugar that gives the ability for attributes to be functions and objects interchangeably. Backbone uses this extensively.

    randString just generates an alpha numeric string. It also allows the user to pass in a length to and a dictionary for extra flexibility.

    feature 
    opened by rstone770 12
  • Performance improvement in string/repeat

    Performance improvement in string/repeat

    I've changed the string/repeat algorithm, from using the array.join to bitwise operators, this way it always be fastest than the original one, more so if the number of times to repeat increases by a lot.

    enhancement 
    opened by n3okill 12
  • Parse numeric character references in unescapeHtml

    Parse numeric character references in unescapeHtml

    This fixes #151.

    Instead of doing a whole lot of replaces, this code simply scans through the string once replacing each escape. A little more complicated, but this brings it closer to the spec (it does not parse all named character references, though, see http://developers.whatwg.org/named-character-references.html#named-character-references for the whole (long) list).

    opened by conradz 12
  • Implementing methods suggested on issue #103.

    Implementing methods suggested on issue #103.

    List of modules implemented:

    • object/camelCaseKeys
    • object/hyphenateKeys
    • object/mapKeys
    • object/underscoreKeys

    Tests are passing and the documentation was also updated.

    closes #103

    opened by rafaelrinaldi 11
  • updated function after behavior

    updated function after behavior

    this is a different implementation of function/after to make sure callback is executed once for each call and also make sure it's always executed asynchronously.

    closes #139. see #138.

    enhancement 
    opened by millermedeiros 10
  • Responsible disclosure policy

    Responsible disclosure policy

    Hey there!

    I belong to an open source security research community, and a member (@yetingli) has found an issue, but doesn’t know the best way to disclose it.

    If not a hassle, might you kindly add a SECURITY.md file with an email, or another contact method? GitHub recommends this best practice to ensure security issues are responsibly disclosed, and it would serve as a simple instruction for security researchers in the future.

    Thank you for your consideration, and I look forward to hearing from you!

    (cc @huntr-helper)

    opened by zidingz 0
  • Handling of null or undefined param in object.merge

    Handling of null or undefined param in object.merge

    Due to the while conditional in object.merge, there is a nasty edge-case which is about null or undefined in object.merge:

    merge({}, null, {foo: 'bar'}) ==> {}
    merge({}, {foo: 'bar'}, null) ==> {foo: 'bar'}
    

    Which is counter-intuitive on how it is on Object.assign:

    Object.assign({}, null, {foo: 'bar'}) ==> {foo: 'bar'}
    Object.assign({}, {foo: 'bar'}, null) ==> {foo: 'bar'}
    

    The same problems exist for undefined instead of null.

    opened by andi1984 0
  • array of objects union has duplicates

    array of objects union has duplicates

    var old_users = [{name:'Adam'},{name:'Aron'},{name:'Bob'}]; var new_users = [{name:'Alan'},{name:'Aron'},{name:'Ben'}];

    var total_users = array.union(old_users, new_users);

    console.log(total_users); // [{name:'Adam'},{name:'Aron'},{name:'Bob'},{name:'Alan'},{name:'Aron'},{name:'Ben'}]

    opened by vabburi82 1
  • Update moutjs.com docs

    Update moutjs.com docs

    All the docs in the repo are up to date but we have to regenerate the online pages and push them. I do not have access to the domain/FTP/server etc for the docs at moutjs.com/docs

    It's not super pressing, but we should probably get around to it eventually.

    /cc @millermedeiros

    task 
    opened by roboshoes 1
  • ES6 compatibility

    ES6 compatibility

    Async just move to ES6, and use lodash for tooling (since lodash provide ES6 compatibility). All our projects are moving to ES6 either. Is mout willing to evolve to this ? Any draft/plans here ?

    I can help !

    opened by 131 8
Owner
Modular JavaScript Utilities
Modular JavaScript Utilities
A modern JavaScript utility library delivering modularity, performance, & extras.

lodash Site | Docs | FP Guide | Contributing | Wiki | Code of Conduct | Twitter | Chat The Lodash library exported as a UMD module. Generated using lo

Lodash Utilities 55.3k Jan 1, 2023
A Javascript library for working with native objects.

Sugar A Javascript library for working with native objects. Install Upgrading Getting Started Documentation Custom Builds Browser npm Modules Date Loc

Andrew Plummer 4.5k Dec 24, 2022
:ram: Practical functional Javascript

Ramda A practical functional library for JavaScript programmers. Why Ramda? There are already several excellent libraries with a functional flavor. Ty

Scott Sauyet 2 Jul 21, 2022
Hardcore Functional Programming for JavaScript

#Preλude-js A truly modular implementation of Haskell's Prelude library in ES6 check out the docs for modules details (WORK IN PROGRESS) install npm i

Alan Soares 96 Jan 1, 2023
This is my to-do list website built with html, css and JavaScript. In this project I used Webpack to bundle JavaScript and ES6 modules to write modular JavaScript.

To-Do-List App This is my to-do list website built with html, css and JavaScript. In this project I used Webpack to bundle JavaScript and ES6 modules

Samuel Mwape 18 Sep 20, 2022
A refreshing JavaScript Datepicker — lightweight, no dependencies, modular CSS

Pikaday A refreshing JavaScript Datepicker Lightweight (less than 5kb minified and gzipped) No dependencies (but plays well with Moment.js) Modular CS

null 7.9k Jan 4, 2023
A refreshing JavaScript Datepicker — lightweight, no dependencies, modular CSS

Pikaday A refreshing JavaScript Datepicker Lightweight (less than 5kb minified and gzipped) No dependencies (but plays well with Moment.js) Modular CS

null 7.9k Jan 4, 2023
JavaScript image gallery for mobile and desktop, modular, framework independent

PhotoSwipe Repository JavaScript image gallery for mobile and desktop. Documentation and getting started guide. Demo and script home page. NPM npm ins

Dmitry Semenov 22.5k Dec 30, 2022
A modular geospatial engine written in JavaScript

A modular geospatial engine written in JavaScript turfjs.org Turf is a JavaScript library for spatial analysis. It includes traditional spatial operat

turf 7.6k Jan 3, 2023
A lightweight, fully-featured, modular, typescript-compatible javascript library for Paymongo.

paymongo.js A lightweight, fully-featured, modular, typescript-compatible javascript library for PayMongo. Installation npm install paymongo.js # or y

Prince Carlo Juguilon 15 Nov 23, 2022
A simple Todo app to add list of books a user has read using HTML, CSS, Webpack, JavaScript and modular architecture

Minimalist A simple Todo app to add list of books a user has read. It is implemented using HTML, CSS, Webpack, JavaScript and modular architecture. A

Elikplim 4 May 9, 2022
JavaScript image gallery for mobile and desktop, modular, framework independent

PhotoSwipe v5 — JavaScript image gallery and lightbox Demo | Documentation Repo structure dist/ - main JS and CSS src/ - source JS and CSS. src/js/pho

Dmytro Semenov 22.4k Dec 29, 2022
frontend package manager and build tool for modular web applications

THIS PROJECT IS DEPRECATED Component is not maintained anymore. See here #639 for more information. You can still use the component registry on compon

Component 4.6k Dec 30, 2022
A lightweight and modular front-end framework for developing fast and powerful web interfaces

UIkit UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces. Homepage - Learn more about UIkit @getui

null 17.7k Jan 8, 2023
Modular and customizable Material Design UI components for the web

Material Components for the web Material Components for the web helps developers execute Material Design. Developed by a core team of engineers and UX

Material Components 16.6k Jan 3, 2023
:bar_chart: A library of modular chart components built on D3

Plottable Plottable is a library of chart components for creating flexible, custom charts for websites. It is built on top of D3.js and provides highe

Palantir Technologies 2.9k Dec 31, 2022
⚡️ Simple, Modular & Accessible UI Components for your React Applications

Build Accessible React Apps with Speed ⚡️ Chakra UI provides a set of accessible, reusable, and composable React components that make it super easy to

Chakra UI 30.5k Jan 4, 2023
A customizable, modular, responsive, lightbox gallery plugin.

lightGallery A customizable, modular, responsive, lightbox gallery plugin for jQuery. Demo JQuery lightGallery demo. Codepen demo Main features Fully

Sachin N 5.6k Jan 4, 2023
:sparkles: Modular, scoped CSS with ES6

CSJS allows you to write modular, scoped CSS with valid JavaScript. Features Extremely simple and lightweight Zero dependencies, ~2KB minified and gzi

Ryan Tsao 577 Nov 18, 2022