Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@36node/query-normalizr
Advanced tools
query-normalizr 的作用: 将 url 中的 query 规则化成方便 sdk 和 service 层调用的数据格式。
yarn add @36node/query-normalizr
import { queryNormalizr } from "@36node/query-normalizr";
// koa app
app.use(normalizr(queryNormalizr));
normalizr(options);
// return koa middleware
import { normalize } from "@36node/query-normalizr";
import qs from "query-string";
const queryStr =
" _expand=department&_group=type&_limit=10&_offset=0&_populate=user&_select=name&_select=age&_sort=updatedAt&_sort=-createdAt&age_gt=10&age_lt=20&level_gte=10&level_lte=20&plate_like=沪A&plate_like=沪B&tag_ne=pretty&title_like=hello&type=test1&type=test2";
normalize(qs.parse(queryStr));
/*
return {
limit: 10,
offset: 0,
sort: ["updatedAt", "-createdAt"],
populate: "user",
select: ["name", "age"],
group: "type",
filter: {
age: {
$gt: "10",
$lt: "20",
},
level: {
$gte: "10",
$lte: "20",
},
plate: {
$regex: [/沪A/i, /沪B/i],
},
tag: {
$ne: "pretty",
},
title: {
$regex: /hello/i,
},
type: ["test1", "test2"]
},
_expand: "department",
};
*/
import { denormalize } from "@36node/query-normalizr";
import qs from "query-string";
const queryObj = {
limit: 10,
offset: 0,
sort: ["updatedAt", "-createdAt"],
populate: "user",
select: ["name", "age"],
group: "type",
filter: {
age: {
$gt: "10",
$lt: "20",
},
level: {
$gte: "10",
$lte: "20",
},
plate: {
$regex: [/沪A/i, /沪B/i],
},
tag: {
$ne: "pretty",
},
title: {
$regex: /hello/i,
},
type: ["test1", "test2"],
},
_expand: "department",
};
qs.stringfy(denormalize(queryObj));
// return " _expand=department&_group=type&_limit=10&_offset=0&_populate=user&_select=name&_select=age&_sort=updatedAt&_sort=-createdAt&age_gt=10&age_lt=20&assignees=%2A&followers=none&level_gte=10&level_lte=20&plate_like=%E6%B2%AAA&plate_like=%E6%B2%AAB&q=hello&tag_ne=pretty&title_like=hello&type=test1&type=test2"
reference in url.md
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
query-normalizr © 36node, Released under the MIT License.
Authored and maintained by 36node with help from contributors (list).
github.com/zzswang · GitHub @36node · Twitter @y
FAQs
A module boilerplate for nodejs and web.
The npm package @36node/query-normalizr receives a total of 111 weekly downloads. As such, @36node/query-normalizr popularity was classified as not popular.
We found that @36node/query-normalizr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.