Skip to content

Commit 547be0d

Browse files
committed
It's all-typescript now
1 parent 76519d0 commit 547be0d

File tree

10 files changed

+3170
-173
lines changed

10 files changed

+3170
-173
lines changed

.github/workflows/release.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
with:
1212
node-version: 16
1313
- run: npm test
14+
- run: npm build
1415
- uses: JS-DevTools/npm-publish@v1
1516
with:
1617
token: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 109 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# General
12
.DS_Store
23
.AppleDouble
34
.LSOverride
@@ -16,6 +17,7 @@ Icon
1617
.TemporaryItems
1718
.Trashes
1819
.VolumeIcon.icns
20+
.com.apple.timemachine.donotpresent
1921

2022
# Directories potentially created on remote AFP share
2123
.AppleDB
@@ -27,28 +29,130 @@ Temporary Items
2729
# Logs
2830
logs
2931
*.log
32+
npm-debug.log*
33+
yarn-debug.log*
34+
yarn-error.log*
35+
lerna-debug.log*
36+
.pnpm-debug.log*
37+
38+
# Diagnostic reports (https://nodejs.org/api/report.html)
39+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
3040

3141
# Runtime data
3242
pids
3343
*.pid
3444
*.seed
45+
*.pid.lock
3546

3647
# Directory for instrumented libs generated by jscoverage/JSCover
3748
lib-cov
3849

3950
# Coverage directory used by tools like istanbul
4051
coverage
52+
*.lcov
53+
54+
# nyc test coverage
55+
.nyc_output
4156

42-
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
57+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
4358
.grunt
4459

60+
# Bower dependency directory (https://bower.io/)
61+
bower_components
62+
4563
# node-waf configuration
4664
.lock-wscript
4765

48-
# Compiled binary addons (http://nodejs.org/api/addons.html)
66+
# Compiled binary addons (https://nodejs.org/api/addons.html)
4967
build/Release
5068

51-
# Dependency directory
52-
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
69+
# Dependency directories
70+
node_modules/
71+
jspm_packages/
72+
73+
# Snowpack dependency directory (https://snowpack.dev/)
74+
web_modules/
75+
76+
# TypeScript cache
77+
*.tsbuildinfo
78+
79+
# Optional npm cache directory
80+
.npm
81+
82+
# Optional eslint cache
83+
.eslintcache
84+
85+
# Optional stylelint cache
86+
.stylelintcache
87+
88+
# Microbundle cache
89+
.rpt2_cache/
90+
.rts2_cache_cjs/
91+
.rts2_cache_es/
92+
.rts2_cache_umd/
93+
94+
# Optional REPL history
95+
.node_repl_history
96+
97+
# Output of 'npm pack'
98+
*.tgz
99+
100+
# Yarn Integrity file
101+
.yarn-integrity
102+
103+
# dotenv environment variable files
104+
.env
105+
.env.development.local
106+
.env.test.local
107+
.env.production.local
108+
.env.local
109+
110+
# parcel-bundler cache (https://parceljs.org/)
111+
.cache
112+
.parcel-cache
113+
114+
# Next.js build output
115+
.next
116+
out
117+
118+
# Nuxt.js build / generate output
119+
.nuxt
120+
dist
121+
122+
# Gatsby files
123+
.cache/
124+
# Comment in the public line in if your project uses Gatsby and not Next.js
125+
# https://nextjs.org/blog/next-9-1#public-directory-support
126+
# public
127+
128+
# vuepress build output
129+
.vuepress/dist
130+
131+
# vuepress v2.x temp and cache directory
132+
.temp
133+
.cache
134+
135+
# Docusaurus cache and generated files
136+
.docusaurus
137+
138+
# Serverless directories
139+
.serverless/
140+
141+
# FuseBox cache
142+
.fusebox/
143+
144+
# DynamoDB Local files
145+
.dynamodb/
146+
147+
# TernJS port file
148+
.tern-port
149+
150+
# Stores VSCode versions used for testing VSCode extensions
151+
.vscode-test
53152

54-
node_modules
153+
# yarn v2
154+
.yarn/cache
155+
.yarn/unplugged
156+
.yarn/build-state.yml
157+
.yarn/install-state.gz
158+
.pnp.*

README.md

Lines changed: 16 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,42 @@
1-
json-decycle (es6)
2-
============
1+
# json-decycle
32

43
Stringify and parse cycled reference json by replacing cycled references to [JSON-reference](https://json-spec.readthedocs.io/reference.html)
54

6-
Is project alive?
7-
----------------
5+
## Is project alive?
86

97
Yes, it works just fine.
108

119
Because this library have no dependencies, it's not required to have frequent updates.
1210

1311
If You encounter a bug or need to support special case, feel free to file an issue or open PR.
1412

15-
Usage
16-
-----
13+
## Usage
1714

18-
```javascript
19-
var decycle = require('json-decycle').decycle
20-
var retrocycle = require('json-decycle').retrocycle
15+
```tsx
16+
import { decycle, retrocycle } from "json-decycle";
2117

2218
var cycled = {
2319
foo: {},
24-
bar: {}
25-
}
20+
bar: {},
21+
};
2622

27-
cycled.foo.bar = cycled.foo
28-
cycled.bar.foo = cycled.bar
23+
cycled.foo.bar = cycled.foo;
24+
cycled.bar.foo = cycled.bar;
2925

30-
var result = JSON.stringify(cycled, decycle())
26+
var result = JSON.stringify(cycled, decycle());
3127
// result === '{"foo":{"bar":{"foo":{"$ref":"#/foo"}}},"bar":{"$ref":"#/foo/bar"}}'
3228

33-
JSON.parse(result, retrocycle())
29+
JSON.parse(result, retrocycle());
3430
// => {foo: {{foo: [cyclic reference], bar: [cyclic reference]}}, bar: {{foo: [cyclic reference], bar: [cyclic reference]}}}
35-
3631
```
3732

38-
Extend JSON global object
39-
-------------------------
33+
## Extend JSON global object
4034

4135
`JSON.parse` and `JSON.stringify` is not modified
4236

43-
```javascript
44-
require('json-decycle').extend(JSON)
45-
46-
JSON.decycle({}) === '{}'
47-
JSON.retrocycle('{}') === {}
48-
```
49-
50-
ES6 features
51-
------------
52-
53-
Library depends on es6 features `Map`, `WeakMap`, `WeakSet` and `Set` so if you environment does not support this features, you can override it:
54-
55-
```javascript
56-
const jsonDecycle = require('json-decycle')
37+
```tsx
38+
import { extend } from "json-decycle";
5739

58-
jsonDecycle.Map = Map
59-
jsonDecycle.WeakMap = WeakMap
60-
jsonDecycle.WeakSet = WeakSet
61-
jsonDecycle.Set = Set
40+
JSON.decycle({}) === "{}";
41+
JSON.retrocycle("{}") === {};
6242
```

0 commit comments

Comments
 (0)