Skip to content

Commit

Permalink
fix: remove lodash usage and types (#432)
Browse files Browse the repository at this point in the history
  • Loading branch information
icholy committed Feb 17, 2023
1 parent 383aa3c commit 9c227d5
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 11 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"@semantic-release/npm": "^7.1.3",
"@semantic-release/release-notes-generator": "^9.0.3",
"@types/jest": "^26.0.20",
"@types/lodash": "^4.14.168",
"@types/node": "^10.5.3",
"@types/picomatch": "^2.2.2",
"@typescript-eslint/eslint-plugin": "^4.17.0",
Expand Down
3 changes: 1 addition & 2 deletions src/frontend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import { concat } from 'lodash';
import { Enforcer } from './enforcer';
import { deepCopy } from './util';

Expand Down Expand Up @@ -53,7 +52,7 @@ export async function casbinJsGetPermissionForUser(e: Enforcer, user?: string):
item.unshift('g');
});

obj['p'] = concat(policy, groupPolicy);
obj['p'] = [...policy, ...groupPolicy];

return JSON.stringify(obj);
}
5 changes: 2 additions & 3 deletions test/model.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
// limitations under the License.
// noinspection JSMismatchedCollectionQueryUpdate

import * as _ from 'lodash';
import { DefaultRoleManager, Enforcer, newEnforcer, newModel } from '../src';
import { keyMatch2Func, keyMatch3Func, keyMatchFunc } from '../src/util';

Expand Down Expand Up @@ -236,8 +235,8 @@ function customFunction(key1: string, key2: string): boolean {
}

function customFunctionWrapper(...args: any[]): boolean {
const name1: string = _.toString(args[0]);
const name2: string = _.toString(args[1]);
const name1 = String(args[0]);
const name2 = String(args[1]);

return customFunction(name1, name2);
}
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1055,11 +1055,6 @@
resolved "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.7.tgz#98a993516c859eb0d5c4c8f098317a9ea68db9ad"
integrity sha512-cxWFQVseBm6O9Gbw1IWb8r6OS4OhSt3hPZLkFApLjM8TEXROBuQGLAH2i2gZpcXdLBIrpXuTDhH7Vbm1iXmNGA==

"@types/lodash@^4.14.168":
version "4.14.168"
resolved "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.168.tgz#fe24632e79b7ade3f132891afff86caa5e5ce008"
integrity sha512-oVfRvqHV/V6D1yifJbVRU3TMp8OT6o6BG+U9MkwuJ3U8/CsDHvalRpsxBqivn71ztOFZBTfJMvETbqHiaNSj7Q==

"@types/minimatch@^3.0.3":
version "3.0.4"
resolved "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.4.tgz#f0ec25dbf2f0e4b18647313ac031134ca5b24b21"
Expand Down

0 comments on commit 9c227d5

Please sign in to comment.