O

Make objects show you their O-face

npm install O
3 downloads in the last week
47 downloads in the last month

O

Object Renaissance. This module has been reworked and has no readme. It's an awesome module though

install

For Node.js

npm install O

For browsers just include it.

Use

// in node
require('O').O()
// browser
O()

Or specify which global object:

// node
var context = O(vm.createContext());
// browser
var context = O(document.createElement('iframe'));

Function

  • Function.stringify(f)
  • Function.create(name, call, construct, proto, descriptors)
  • Function.isFunction(o)
  • Function.isArguments(o)
  • Function.invoker(name)
  • Function.compose(f1, f2, ...)
  • Function.collate(o, context)
  • Function.dobind(f)
  • Function.doapply(f)
  • Function.docall(f)

Function.prototype

  • Function.prototype.bindbind()
  • Function.prototype.callbind()
  • Function.prototype.applybind()
  • Function.prototype.partial()
  • Function.prototype.inherit(Super, properties)
  • Function.prototype.collate(context)

Object

  • Object.stringify(o)
  • Object.clone(o)
  • Object.lower(o)
  • Object.isObject(o)
  • Object.isIndexed(o)
  • Object.decorate(o)
  • Object.enumerate(o)
  • Object.get(o, key)
  • Object.set(o, key, value)
  • Object.unset(o, key)
  • Object.has(o, key)
  • Object.hasOwn(o, key)
  • Object.hide(o, key, value)
  • Object.show(o, key)
  • Object.is(o, p)
  • Object.getPrototypesOf(o)
  • Object.getPropertyNames(o)
  • Object.getPropertyDescriptor(o, key)
  • Object.getPropertyDescriptors(o)
  • Object.getOwnPropertyDescriptors(o)
  • Object.defineLazyProperty(o, key, getter, readonly)
  • Object.setPrototypeOf(o, proto)
  • Object.injectPrototype(o, proto)

Object.prototype

  • Object.prototype.forEach(callback, context)
  • Object.prototype.map(callback, context)
  • Object.prototype.decorate(...)

Array

  • Array.stringify(o)
  • Array.create(proto, descriptors)
  • Array.from(o)
  • Array.merge()

Array.prototype

  • Array.prototype.unique()
  • Array.prototype.first(callback, context)
  • Array.prototype.pushAll()
  • Array.prototype.flatten(deep)
  • Array.prototype.chunk(size)
  • Array.prototype.forEachF(callback, context)
  • Array.prototype.mapF(callback, context)

Date

  • Date.stringify(o)
  • Date.isDate(o)
  • Date.create(args, proto, descriptors)

String

  • String.isString(o)
  • String.uid()
  • String.unique(array, ignoreCase)

String.prototype

  • String.prototype.repeat(count)
  • String.prototype.startsWith(substring, fromIndex)
  • String.prototype.endsWith(substring, fromIndex)
  • String.prototype.contains(substring, fromIndex)
  • String.prototype.reverse()
  • String.prototype.slug()
  • String.prototype.recase(n)
  • String.prototype.toIdentifier()
  • String.prototype.camel(s)
  • String.prototype.dash(s)
  • String.prototype.toBuffer()

Number

  • Number.isNumber(o)
  • Number.isInt(n)
  • Number.isNaN(n)
  • Number.fromPercent(v)
  • Number.toUint32(n)
  • Number.toInt32(n)
  • Number.toInt(n)
  • Number.toFinite(n)
  • Number.type(n)
  • Number.unique(array)

Number.prototype

  • Number.prototype.toPercent()
  • Number.prototype.isInt()
  • Number.prototype.clamp(min, max)
  • Number.prototype.min(n)
  • Number.prototype.max(n)
  • Number.prototype.pow(n)
  • Number.prototype.avg(n)
  • Number.prototype.sqrt()
  • Number.prototype.cubert()
  • Number.prototype.sq()
  • Number.prototype.cube()

RegExp

  • RegExp.stringify(o)
  • RegExp.toSource(o)
  • RegExp.isRegExp(o)
  • RegExp.create(pattern, flags, proto, descriptors)
  • RegExp.escape(s)
  • RegExp.concat(flags, regexes)

RegExp.prototype

  • RegExp.prototype.globalize()
  • RegExp.prototype.flags()
  • RegExp.prototype.match(str)
  • RegExp.prototype.filter(array)

Map

  • Map.createStorage(creator)

WeakMap

  • WeakMap.createStorage(creator)
npm loves you