Generic badge Maintenance Maintaner Website shields.io made-with-Markdown made-for-VSCode GitHub license Profile views GitHub contributors GitHub issues
GitHub forks GitHub stars GitHub watchers GitHub followers

OOI

JavaScript Utility & Tools Library


Home Report Bug Request Feature

function
aliases (data, { propName: [...aliases] }) => data
Defines property aliases for object.
const ooi = require('ooi');

let data = {
  one: 1,
  two: 2,
  three: 3,
};

ooi.aliases(data, {
  one: ['first', 'number1'],
  two: ['second', 'number2'],
  three: ['third', 'number3'],
});
Requires: ooi, each, extend, flatten, defaults, type, get, set, map, keys, trim, ensure-array
Filename: ooi/aliases.js
function
define.box (object, name[, isEnumerable]) => data
Defines new virtual property on object and serves it by property name. If the property gets assigned — new object deep merges with existing.
import define.box from 'ooi/define';

let result = define.box(object, name[, isEnumerable]);
Requires: each, extend, flatten, set, range
Filename: ooi/define.js
function
define.prop ({ object, name, value, get, set, configurable, enumerable, writable }) => object
Defines new property on object.
import define.prop from 'ooi/define';

let result = define.prop({ object, name, value, get, set, configurable, enumerable, writable });
Requires: each, extend, flatten, set, range
Filename: ooi/define.js
function
extend (target, ...sources) => object
Extends `target` object with properties of sources objects.
import extend from 'ooi/extend';

let result = extend(target, ...sources);
Requires: each, set, get, flatten
Filename: ooi/extend.js
function
extend.deep (target, ...sources) => object
Extends `target` object with properties of sources objects (deep extending).
import extend.deep from 'ooi/extend';

let result = extend.deep(target, ...sources);
Requires: each, set, get, flatten
Filename: ooi/extend.js
function
keys (object) => array
Returns array of `object` property names.
import keys from 'ooi/keys';

let result = keys(object);
Filename: ooi/keys.js
function
proto (object) => prototype
Returns object's prototype.
import proto from 'ooi/proto';

let result = proto(object);
Requires: extend
Filename: ooi/proto.js
function
proto.chain (obj1, obj2, obj3) => void
Sets second argument as prototype of first, third as prototype of second etc.
import proto.chain from 'ooi/proto';

let result = proto.chain(obj1, obj2, obj3);
Requires: extend
Filename: ooi/proto.js