0.4.8 • Published 5 years ago

brace_prototype v0.4.8

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Brace Prototype

Synopsis

Build status Downloads

A part of the Brace suiteDeveloped with Windows 10 and Ubuntu 16
BraceUbuntu on Windows

Document pages


Author: Robert Steckroth, Bust0ut <RobertSteckroth@gmail.com>

Licensed under: MIT

Bonuses:

  • Does a good job of unit testing Brace UMD as well as this project.

The primary purpose of this library is to create option like data within a prototype for user operation. NOTE: It does not provide a best practice for ECMA prototype chains. The library provides a member which returns an Object to be used in a prototype. The returned Object contains a few additional methods which operate on the prototype. Below are the members which are created with the library return Object.

clear - string, ...

  • The clear member should be called with no parameters or with zero to many string parameters. All of the properties added with the original constructor (the usable members), will have the values reset to the current prototype value. An empty call clears all of the usable values while only those properties matching the strings passed in will be reset if parameters are passed in. This member is idempotent.

proto_extend - object

  • This will extend the current prototype it is attached to with a complete description of the passed in Object. These properties are not added as usable members.

extend - object

  • This will extend the Brace_prototype Object with a complete description of the passed in Object. These properties are not added as usable members.

add_qualifier - string

  • Adds a property to the current list of usable members.

add_hidden_qualifier - string

  • Adds a hidden property to the list of members. This should be used when a getter/setter returns a value which is supposed to be a usable member.

remove_hidden_qualifier - string

  • Removes a hidden qualifier from the list.

remove_qualifier - string

  • Remove a property from the current list of usable members.

list - []

  • This will return a prototype de-coupled Object which contains all of the current usable properties. Updating this Object directly is not advised. All of the values are null as the qualifiers are the significant data.

Basic example of brace_prototype usage:

if (typeof define !== 'function') { var define = require('amdefine')(module) }

define(["brace_prototype"], function(proto) {

	// usable_one and usable_two are mantained by brace prototype.
	var p = proto({
		usable_one: "cool",
		usable_two: "joes"

	})

	// The prototype can be extended this way. These are basic prototype members.

	var User = function() { 
	}

	User.prototype = p.extend({
		whats_up: function() { 
			console.log("doc")
		}
	})

	console.log(p.list())
})
0.4.8

5 years ago

0.4.7

7 years ago

0.4.4

8 years ago

0.4.3

8 years ago

0.4.2

8 years ago

0.4.1

8 years ago

0.4.0

8 years ago

0.3.1

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.9

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.3

8 years ago