npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mo

v1.7.3

Published

A collection of OzJS core modules that form a library called "Mo"

Downloads

2,990

Readme

Mo

  • A collection of OzJS core modules that form a library called "Mo"

In NodeJS

npm install mo

In browser

bower install mo

Or download directly from Github

AMD and OzJS

Modules Overview

Examples

API and usage

mo/lang

var _ = require('mo/lang');
  • same as below

mo/lang/es5

require('mo/lang/es5');
  • Array.prototype.forEach
  • Array.prototype.map
  • Array.prototype.filter
  • Array.prototype.reduce
  • Array.prototype.reduceRight
  • Array.prototype.some
  • Array.prototype.every
  • Array.prototype.indexOf
  • Array.prototype.lastIndexOf
  • Array.isArray
  • String.prototype.trim
  • Date.now
  • Object.keys
  • Object.create - partial support: Object.create(obj) / Object.create(obj, { method: { value: func } })
  • Object.getPrototypeOf
  • Function.prototype.bind

mo/lang/es6

require('mo/lang/es6');
  • same as mo/lang/es6-utils + mo/lang/es6-collection + mo/lang/es6-promise

mo/lang/es6-utils

require('mo/lang/es6-utils');
  • Array.prototype.find
  • Array.prototype.findIndex
  • Array.prototype.fill
  • Array.prototype.copyWithin
  • Array.of
  • Array.from
  • String.prototype.startsWith
  • String.prototype.endsWith
  • String.prototype.contains
  • String.prototype.repeat
  • Number.MAX_SAFE_INTEGER
  • Number.MIN_SAFE_INTEGER
  • Number.EPSILON
  • Number.isFinite
  • Number.isInteger
  • Number.isSafeInteger
  • Number.isNaN
  • Object.is
  • Object.assign

mo/lang/es6-collection

require('mo/lang/es6-collection');
  • Map.prototype.get
  • Map.prototype.set
  • Map.prototype.delete
  • Map.prototype.clear
  • Map.prototype.size
  • Map.prototype.forEach
  • Map.prototype.has
  • WeakMap.prototype.get
  • WeakMap.prototype.set
  • WeakMap.prototype.delete
  • WeakMap.prototype.clear
  • WeakMap.prototype.has
  • Set.prototype.add
  • Set.prototype.delete
  • Set.prototype.clear
  • Set.prototype.size
  • Set.prototype.forEach
  • Set.prototype.has
  • WeakSet.prototype.add
  • WeakSet.prototype.delete
  • WeakSet.prototype.clear
  • WeakSet.prototype.has

mo/lang/es6-promise

require('mo/lang/es6-promise');
  • new Promise(function(resolve, reject){})
  • Promise.prototype.then(onFulfilled, onRejected)
  • Promise.prototype.catch(onRejected)
  • Promise.resolve(result|thenable)
  • Promise.reject(reason)
  • Promise.all(promises)
  • Promise.race(promises)

mo/lang/type

var _ = require('mo/lang/type');
  • _.type(sth) --
  • _.isFunction(sth) --
  • _.isWindow(sth) --
  • _.isEmptyObject(sth) --
  • _.isArraylike(sth) --
  • _.ns(string, value) --

mo/lang/mix

var _ = require('mo/lang/mix');
  • _.mix(origin, obj1, obj2, ..., depth) --
  • _.merge(origin, obj1, obj2, ..., depth) --
  • _.interset(origin, obj1, obj2, ..., depth) --
  • _.copy(origin, depth) --
  • _.occupy(origin, obj, depth) --
  • _.defaults(origin, obj1, obj2, ..., depth) --
  • _.config(cfg, opt, DEFAULT_CFG) --
  • _.unique(list) --
  • _.each(obj, mapfn, context) --

mo/lang/oop

var _ = require('mo/lang/oop');

var List = _.construct(Array, /*mixes, */function(){
    this.superConstructor.apply(this, arguments);
    this.a = 1;
});

List.prototype.forEach = function(){
    return this.superMethod('forEach', arguments);
};

mo/lang/struct

var _ = require('mo/lang/struct');
  • _.index(array, key) --
  • _.fnQueue() --

mo/domready

require(['mo/domready'], function(none){
    // won't execute until the page's entire DOM has loaded
});

mo/browsers

var browsers = require('mo/browsers');
  • browsers.browser --
  • browsers.version --
  • browsers.engine --
  • browsers.engineversion --
  • browsers.os --
  • browsers.osversion --
  • browsers.isMobile --
  • browsers.skin --
  • browsers.rank --
  • browsers.ua --
  • browsers['msie'|'safari'|'mobilesafari'|'chrome'|'aosp'|'mozilla'|...] --

mo/cookie

var cookie = require('mo/cookie');

cookie(name, value, {
    domain: 'ozjs.org', // '' as default
    path: '/', // '' as default
    expires: 365 // day,
    secure: ''
});

mo/template

var tpl = require('mo/template');
  • tpl.str2html(string) --
  • same as below

mo/template/string

var tpl = require('mo/template/string');
  • tpl.format(string, dict|list) --
  • tpl.escapeHTML(string) --
  • tpl.substr(string, limit, callback) --
  • tpl.strsize(string) --

mo/template/micro

var tpl = require('mo/template/micro');
  • tpl.convertTpl(tplName|tplString, dictData, namespace) --
  • tpl.reloadTpl(tplName) --

mo/network

var net = require('mo/network');
  • net.getScript(url, callback) --
  • net.getStyle(url) --
  • net.getJSON(url, params, callback, options) --
  • net.getRequest(url, params) --
  • net.parseJSON(data) --
  • same as below

mo/network/ajax

var net = require('mo/network/ajax');
  • net.ajax(options) --
  • net.params(data) --

mo/easing

var easingLib = require('mo/easing');
  • easingLib.def --
  • easingLib.values --
  • easingLib.functions --
// use it as extension of other library

var $ = require('jquery');
$.easing['jswing'] = $.easing['swing'];
$.extend($.easing, easingLib.functions);

require('mo/mainloop').config({
    easing: easingLib.functions
});

require('choreo').config({
    easing: easingLib
});

mo/mainloop

var loop = require('mo/mainloop');
  • loop.config(options) --
  • loop.run(optional_stageName) --
  • loop.pause(stageName) --
  • loop.complete(stageName) --
  • loop.remove(stageName) --
  • loop.info(stageName) --
  • loop.isRunning(stageName) --
  • loop.addStage(stageName, optional_canvas) --
  • loop.addRender(stageName, render, optional_canvas) --
  • loop.getRender(renderId) --
  • loop.addTween(stageName, current, end, duration, options) --

mo/key

var Key = require('mo/key');
  • Key.KEYS_CODE --
var key = Key(config);
  • key.addHandler(event, keyName, handler) --
  • key.down([keyName, ...], handler) --
  • key.up([keyName, ...], handler) --
  • key.press([keyName, ...], handler) --
  • key.reset() --
  • key.addRule(fn) --
  • key.enable() --
  • key.disable() --
  • key.check() --

mo/console

var console = require('mo/console');
  • console.config({ output: elm }) --
  • console.enable() --
  • console.disable() --
  • console.run(func) --
  • console.log(sth, sth, ...) --
  • console.info(sth, sth, ...) --
  • console.warn(sth, sth, ...) --
  • console.error(sth, sth, ...) --

Under construction...

More References

See OzJS Project Homepage

Release History

See OzJS Release History

License

Copyright (c) 2010 - 2013 dexteryy
Licensed under the MIT license.