Socket
Socket
Sign inDemoInstall

@platform/util.string

Package Overview
Dependencies
Maintainers
1
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@platform/util.string - npm Package Compare versions

Comparing version 0.4.11 to 0.5.0

lib/queryString/types.d.ts

1

lib/index.d.ts
import * as str from './str';
export { str };
export * from './queryString';
export * from './types';

23

lib/queryString/queryString.d.ts

@@ -1,9 +0,16 @@

declare type QueryValue = string | boolean;
declare type QueryObject = {
[key: string]: QueryValue | QueryValue[];
import * as t from './types';
export * from './types';
export declare function toObject<T extends t.UrlQueryObject>(href?: string): T;
export declare function valueAsFlag<T>(value?: string | string[] | number | boolean): T;
export declare function isFlag(keys: string | string[] | undefined, query?: t.UrlQuery): boolean;
export declare function build(options?: {
allowNil?: boolean;
}): {
parts: {
key: string;
value?: string | number | boolean | null | undefined;
entry: string;
}[];
add(key: string, value?: string | number | boolean | null | undefined): any;
toString(): string;
};
export declare type UrlQuery = Record<string, string | string[] | number | boolean | undefined>;
export declare function toObject<T extends QueryObject>(href?: string): T;
export declare function valueAsFlag<T>(value?: string | string[] | number | boolean): T;
export declare function isFlag(keys: string | string[] | undefined, query?: UrlQuery): boolean;
export {};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var common_1 = require("../common");

@@ -55,1 +56,22 @@ function toObject(href) {

exports.isFlag = isFlag;
function build(options) {
if (options === void 0) { options = {}; }
var allowNil = options.allowNil === undefined ? true : options.allowNil;
var builder = {
parts: [],
add: function (key, value) {
var isNil = value === undefined || value === null;
if (!allowNil && isNil) {
return builder;
}
var entry = isNil ? key : key + "=" + encodeURIComponent(value || '');
builder.parts = tslib_1.__spreadArrays(builder.parts, [{ key: key, value: value, entry: entry }]);
return builder;
},
toString: function () {
return builder.parts.length === 0 ? '' : "?" + builder.parts.map(function (p) { return p.entry; }).join('&');
},
};
return builder;
}
exports.build = build;

@@ -0,1 +1,2 @@

export * from './types';
export * from './wildcard';

@@ -2,0 +3,0 @@ export * from './convert';

{
"name": "@platform/util.string",
"version": "0.4.11",
"version": "0.5.0",
"description": "String helpers.",

@@ -5,0 +5,0 @@ "main": "lib/index",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc