Skip to content

Commit

Permalink
Update linting format
Browse files Browse the repository at this point in the history
  • Loading branch information
ndaidong committed Oct 26, 2024
1 parent 3f19e74 commit 3619674
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 58 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ on: [push, pull_request]

jobs:
test:

runs-on: ubuntu-latest

strategy:
Expand Down
70 changes: 35 additions & 35 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ name: "CodeQL"

on:
push:
branches: [ main ]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
branches: [main]
schedule:
- cron: '33 18 * * 3'
- cron: "33 18 * * 3"

jobs:
analyze:
Expand All @@ -21,39 +21,39 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
language: ["javascript"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ for (let i = 0; i < 5; i++) {

```html
<script type="module">
import { genid } from "https://esm.sh/@ndaidong/bellajs";
// import { genid } from 'https://unpkg.com/@ndaidong/bellajs/esm/mod.js';
import { genid } from "https://esm.sh/@ndaidong/bellajs";
// import { genid } from 'https://unpkg.com/@ndaidong/bellajs/esm/mod.js';
for (let i = 0; i < 5; i++) {
console.log(genid());
}
for (let i = 0; i < 5; i++) {
console.log(genid());
}
</script>
```

Expand Down
40 changes: 23 additions & 17 deletions mod.ts
Original file line number Diff line number Diff line change
@@ -1,52 +1,58 @@
// mod.ts

import { hasProperty, isArray, isObject, isString, isDate } from "./utils/detection.ts";
import {
hasProperty,
isArray,
isDate,
isObject,
isString,
} from "./utils/detection.ts";

export type AnyObject = { [key: string]: any };

export const clone = (val: any, history: any = null): any => {
const stack = history || new Set()
const stack = history || new Set();

if (stack.has(val)) {
return val
return val;
}

stack.add(val)
stack.add(val);

if (isDate(val)) {
return new Date(val.valueOf())
return new Date(val.valueOf());
}

const copyObject = (o: any): any => {
const oo = Object.create({})
const oo = Object.create({});
for (const k in o) {
if (hasProperty(o, k)) {
oo[k] = clone(o[k], stack)
oo[k] = clone(o[k], stack);
}
}
return oo
}
return oo;
};

const copyArray = (a: any): any => {
return [...a].map((e: any): any => {
if (isArray(e)) {
return copyArray(e)
return copyArray(e);
} else if (isObject(e)) {
return copyObject(e)
return copyObject(e);
}
return clone(e, stack)
})
}
return clone(e, stack);
});
};

if (isArray(val)) {
return copyArray(val)
return copyArray(val);
}

if (isObject(val)) {
return copyObject(val)
return copyObject(val);
}

return val
return val;
};

export function copies(
Expand Down

0 comments on commit 3619674

Please sign in to comment.