UNPKG
own2json
Version:
latest (1.0.0)
1.0.0
Stringify objects own properties
github.com/continuationlabs/own2json
continuationlabs/own2json
own2json
/
lib
/
index.js
15 lines
(10 loc)
•
240 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'use strict'
;
module
.
exports
=
function
toJson
(
) {
var
keys =
Object
.
getOwnPropertyNames
(
this
);
var
result = {};
for
(
var
i =
0
; i < keys.
length
; ++i) {
var
key = keys[i]; result[key] =
this
[key]; }
return
result; };