Skip to content
This repository has been archived by the owner on Mar 6, 2019. It is now read-only.

Commit

Permalink
More header fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
bluefeet committed Jan 16, 2015
1 parent 7724be9 commit c18c848
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 86 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
o.js
====
# o.js

JavaScript utility belt for rich objects and prototypes. Ooooh!

# Resources
## Resources

- [The o-js.com Site](http://o-js.com)
- [o.Class Documentation](doc/o-Class.md)
Expand All @@ -13,7 +12,7 @@ JavaScript utility belt for rich objects and prototypes. Ooooh!
- [Types Documentation](doc/Types.md)
- [Plumbing Documentation](doc/Plumbing.md)

# Custom Builds
## Custom Builds

Custom builds of o.js, containing only the features you need, can be created easily by cloning the o-js repo, getting your environment setup (see Developer Setup below), and using the `bin/combine` tool like this:

Expand All @@ -27,7 +26,7 @@ Make sure that you know which version of o.js you are creating a build of. If y

Then when you run `bin/combine` you'll be using the code from that version.

# Contributing
## Contributing

Changes to o.js must be minimal and deliberate. Currently the focus is contradictory - add helpful features, increase browser/platform support, and reduce the minified size.

Expand All @@ -40,7 +39,7 @@ The typical way to contribute changes to o.js is by forking the GitHub repositor
- Use the same coding style as the rest of the code base.
- Run `grunt` which will lint your changes, run all tests, and integrate your changes with the combined o.js and uglified o.min.js.

# Developer Setup
## Developer Setup

In order to run the tests, minify the javascript, and/or create a custom build you'll want to install some development tools.

Expand All @@ -52,7 +51,7 @@ In order to run the tests, minify the javascript, and/or create a custom build y
- `npm install -g grunt-cli tap`
- Make sure everything works by running `grunt`.

# Media
## Media

Currently the only branding that o.js has is the icon which is used for the site's `favicon.png` and, slightly modified, for the `apple-touch-icon.png`.

Expand Down
41 changes: 20 additions & 21 deletions doc/Plumbing.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
Plumbing
========
# Plumbing

# Utilities
## Utilities

## construct
### construct

<constructor> = o.construct( <constructor>, <prototype> );

Expand All @@ -22,7 +21,7 @@ console.log( bilbo.hoursOld() ); // 972,360

Provides shorthand for creating a new constructor with a prototype. The `prototype` will be merged in to the `constructor`'s prototype.

## augment
### augment

<newConstructor> = o.augment( <parentConstructor>, <constructor>, [<prototype>] )

Expand All @@ -41,7 +40,7 @@ Uses `o.around` where `parentConstructor` is the `origFunction` and `constructor

Typically, in JavaScript inheritance, all that is setup is prototype inheritance. This function takes this a step further by also inheriting the constructor function so that construction logic is maintained in the inheriting constructor.

## merge
### merge

<object1> = o.merge( <object1>, <object2> [...] );

Expand All @@ -52,7 +51,7 @@ var merged = o.merge({a:1,b:1}, {b:2,c:2}, {c:3,d:3});

Takes the first object and merges all subsequent objects in to it. The farther right in the list the object is, the higher its precedence is. Returns the first object.

## clone
### clone

<newObject> = o.clone( <object> );

Expand All @@ -64,7 +63,7 @@ console.log( obj2.foo ); // 'bar'

Clones the object by returning a new one with the same keys and values, constructor, and prototype.

## has
### has

<boolean> = o.has( <object>, <key> );

Expand All @@ -75,7 +74,7 @@ if (o.has(obj, 'foo')) { /* do something */ }

This is just shorthand for calling `hasOwnProperty`.

## local
### local

o.local( <object>, <property>, <function> );

Expand All @@ -99,11 +98,11 @@ If an exception is thrown during the function's execution the exception will be
the property will still be restored to its original value, and the exception will be
rethrown.

## ucFirst
### ucFirst

# Function Modifiers
## Function Modifiers

## before
### before

<newFunction> = o.before( <origFunction>, <beforeFunction> );

Expand All @@ -116,7 +115,7 @@ combined(); // Logs "before", then "main".

Creates a new function where the `beforeFunction` will be called before the `origFunction`.

## after
### after

<newFunction> = o.after( <origFunction>, <afterFunction> );

Expand All @@ -129,7 +128,7 @@ combined(); // Logs "main", then "after".

Creates a new function where the `afterFunction` will be called after the `origFunction`.

## around
### around

<newFunction> = o.around( <origFunction>, <aroundFunction> );

Expand All @@ -142,17 +141,17 @@ combined(2); // Logs 3.

Creates a new function where the `aroundFunction` will be called with an extra first argument, a function that will call the origFunction.

# Properties
## Properties

## reader
### reader

## writer
### writer

## accessor
### accessor

## predicate
### predicate

## clearer
### clearer

## proxy
### proxy

53 changes: 26 additions & 27 deletions doc/o-Attribute.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
o.Attribute
===========
# o.Attribute

Attributes provide the majority of the features provided by o.js. Attributes manage
a single value of an object by providing validation, filtering, access restriction,
Expand All @@ -20,32 +19,32 @@ var Contract = new o.Class({
});
```

# Arguments
## Arguments

## key
### key

key: <string>

This is the only required argument when creating an attribute and it is used as the
basis of the defaults of many of the other arguments.

## argKey
### argKey

[argKey: <string>]

The key in the arguments that this attribute should pull its value from. Defaults
to the `key` argument. If you set this to `null` then the attribute will not get a
value from the arguments.

## valueKey
### valueKey

[valueKey: <string>]

The key name that will be used to store the value in the object. By default this
will be the `key` with an underscore prepended. So, if the key was `color` then the
valueKey would default to `_color`.

## devoid
### devoid

[devoid: <value|function>]

Expand All @@ -59,15 +58,15 @@ read (it is lazy).
If you'd like the default itself to be a function then your devoid should be a
function that returns a function.

## builder
### builder

[builder: <methodName>]

Declare a method name to be called to assign the default value for the attribute if
none is provided by the arguments. This is an alternative to `devoid` and typically
is cleaner to use.

## required
### required

[required: <true|false>]

Expand All @@ -77,7 +76,7 @@ JavaScript's null **is** considered a defined value).
Note that the required check is only evaluated when the attribute value is read (it
is lazy).

## type
### type

[type: <typeOfString|function|TypeObject>

Expand All @@ -89,7 +88,7 @@ calling `typeof` on the value returns the same string, 2) by passing a function
will be called with the value as its only argument and is expected to return true or
false, or 3) an [o.Type](o-Type.md) object.

## coerce
### coerce

[coerce: <true|false>]

Expand All @@ -98,7 +97,7 @@ supports coercion).

Defaults to false.

## filter
### filter

[filter: <function>]

Expand All @@ -110,7 +109,7 @@ This argument is provided for the sake of simple one-off filtering. If you want
reuse the filtering you should probably just make a type and use coercions for your
filtering.

## augments
### augments

[augments: <constructor>]

Expand All @@ -120,14 +119,14 @@ Given a constructor function this will validate that the value being written is
The same functionality can be had be creating a new `o.InstanceOfType` and assigning
the type argument to it.

## chain
### chain

[chain: <true|false>]

Be default, when writing a value, the old value is returned by the writer. But, if
chain is true the object will be returned instead, allowing you to chain together writes.

## reader
### reader

[reader: <string>]

Expand All @@ -136,7 +135,7 @@ Defaults to the value of `key`.

Set to `false` to disable the creation of the reader method.

## writer
### writer

[writer: <string>]

Expand All @@ -149,7 +148,7 @@ Setting to `true` will cause the writer to be the same as `key`.
the method acts like a typical accessor where it acts as a reader if an argument is not
passed, and acts as a writer if an argument is passed.

## predicate
### predicate

[predicate: <string>]

Expand All @@ -161,7 +160,7 @@ If you set the predicate to `true` then the predicate method will default to the
with `has` prefixed to it, so if the key was `age` then the predicate, when set to
`true`, would default to `hasAge`.

## clearer
### clearer

[clearer: <string>]

Expand All @@ -173,7 +172,7 @@ If you set the clearer to `true` then the clearer method will default to the `ke
`clear` prefixed to it, so if the key was `age` then the clearer, when set to `true`,
would default to `clearAge`.

## proxies
### proxies

[proxies: <mappingObject>]

Expand Down Expand Up @@ -201,39 +200,39 @@ Given an object this will proxy specified method calls on the object to calls on

Proxying methods can be a much cleaner and more flexible way of extending another object's functionality without having to inherit from it.

# Methods
## Methods

## getValue
### getValue

<attribute>.getValue( <object> );

Given an object, this returns the value of the attribute on that object.

## setValue
### setValue

<attribute>.setValue( <object>, <value> );

Given an object, this sets the value of the attribute on the object.

## hasValue
### hasValue

<attribute>.hasValue( <object> );

Returns `true` if the object has the attribute value set (not `undefined`), false otherwise.

## clearValue
### clearValue

<attribute>.clearValue( <object> );

Clears the attribute value on the object, leaving it in an `undefined` state.

## setValueFromArgs
### setValueFromArgs

<attribute>.setValueFromArgs( <object>, <arguments> );

Given an object and arguments this will find the appropriate arguments for this attribute and set it on the object.

## install
### install

<attribute>.install( <object>, [<arguments>] );

Expand All @@ -243,7 +242,7 @@ the object.
If `<arguments>` are passed then `setValueFromArgs` will be called after the attribute
is installed.

## rebuild
### rebuild

<newAttribute> = <attribute>.rebuild( <args> );

Expand Down
3 changes: 1 addition & 2 deletions doc/o-Class.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
o.Class
=======
# o.Class

`o.Class` is a thin wrapper around a `o.Trait` and accepts all the same arguments. The
underlying trait of the class is installed on the class's prototype so that any objects
Expand Down
Loading

0 comments on commit c18c848

Please sign in to comment.