MCPcopy
hub / github.com/jprichardson/string.js / initialize

Function initialize

lib/string.js:33–56  ·  view source on GitHub ↗
(object, s)

Source from the content-addressed store, hash-verified

31//******************************************************************************
32
33 function initialize (object, s) {
34 if (s !== null && s !== undefined) {
35 if (typeof s === 'string')
36 object.s = s;
37 else
38 object.s = s.toString();
39 } else {
40 object.s = s; //null or undefined
41 }
42
43 object.orig = s; //original object, currently only used by toCSV() and toBoolean()
44
45 if (s !== null && s !== undefined) {
46 if (object.__defineGetter__) {
47 object.__defineGetter__('length', function() {
48 return object.s.length;
49 })
50 } else {
51 object.length = s.length;
52 }
53 } else {
54 object.length = -1;
55 }
56 }
57
58 function S(s) {
59 initialize(this, s);

Callers 2

SFunction · 0.85
string.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected