Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
JavaScript
Branch: gh-pages
Pull request Compare This branch is even with gh-pages.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
docs
src
test
.gitignore
.npmignore
README.md
index.html
package.json

README.md

pd link

A small utility for writing OO javascript.

pd is short for property descriptor.

It converts objects into property descriptors. So you can create objects like:

var o = Object.create(somePrototype, pd({
    "someProp": "someValue"
    get someGetter() {

    },
    set someSetter() {

    }
}));

Examples link

Documentation link

See the annotated source code

pd link

pd converts all the values of your objects properties into propertydescriptors of those values.

pd({
    "foo": "bar"
})

is the same as

{
    "foo": {
        "value": "bar",
        "enumerable": true,
        "writable": true,
        "configurable": true
    }
}

pd.merge link

pd.merge merges objects together. Any key clashes are given right preference

pd.merge(
    {
        "one": "faz",
        "three": "bar"
    },
    {
        "two": "ni",
        "three": "baz"
    },
    {
        "three": "bas",
        "four": "four"
    }
);

is the same as

{
    "one": "faz",
    "two": "ni",
    "three": "bas",
    "four": "four"
}    

pd.object link

pd.object is a simple Object.create shorthand.

pd.object(o)

is the same as

Object.create(Object.prototype, pd(o));
Something went wrong with that request. Please try again.