Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@loadsmart/utils-string

Package Overview
Dependencies
Maintainers
20
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loadsmart/utils-string - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

lib/isBlank.d.ts

2

lib/index.d.ts

@@ -5,3 +5,5 @@ import { objectFromQueryString } from './objectFromQueryString'

import { toLocaleCapitalizeFirstLetter } from './toLocaleCapitalizeFirstLetter'
import isBlank from './isBlank'
export {
isBlank,
objectFromQueryString,

@@ -8,0 +10,0 @@ queryStringFromObject,

4

lib/index.js
'use strict'
Object.defineProperty(exports, '__esModule', { value: true })
exports.toCapitalizeFirstLetter = exports.toLocaleCapitalizeFirstLetter = exports.queryStringFromObject = exports.objectFromQueryString = void 0
exports.toCapitalizeFirstLetter = exports.toLocaleCapitalizeFirstLetter = exports.queryStringFromObject = exports.objectFromQueryString = exports.isBlank = void 0
var objectFromQueryString_1 = require('./objectFromQueryString')

@@ -32,2 +32,4 @@ Object.defineProperty(exports, 'objectFromQueryString', {

})
var isBlank_1 = require('./isBlank')
exports.isBlank = isBlank_1.default
//# sourceMappingURL=index.js.map

@@ -1,3 +0,1 @@

export declare const objectFromQueryString: (
qs: string
) => Record<string, any> | null
export declare const objectFromQueryString: (qs: string) => Record<string, any> | null;

@@ -1,16 +0,14 @@

'use strict'
Object.defineProperty(exports, '__esModule', { value: true })
exports.objectFromQueryString = void 0
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.objectFromQueryString = void 0;
exports.objectFromQueryString = function (qs) {
if (!qs) return null
if (qs[0] === '?') {
qs = qs.slice(1)
}
return JSON.parse(
'{"' + qs.replace(/&/g, '","').replace(/=/g, '":"') + '"}',
function (key, value) {
return key === '' ? value : decodeURIComponent(value)
if (!qs)
return null;
if (qs[0] === '?') {
qs = qs.slice(1);
}
)
}
//# sourceMappingURL=objectFromQueryString.js.map
return JSON.parse('{"' + qs.replace(/&/g, '","').replace(/=/g, '":"') + '"}', function (key, value) {
return key === '' ? value : decodeURIComponent(value);
});
};
//# sourceMappingURL=objectFromQueryString.js.map

@@ -1,3 +0,1 @@

export declare const queryStringFromObject: (
obj: Record<string, string | number | boolean>
) => string | null
export declare const queryStringFromObject: (obj: Record<string, string | number | boolean>) => string | null;

@@ -1,25 +0,19 @@

'use strict'
Object.defineProperty(exports, '__esModule', { value: true })
exports.queryStringFromObject = void 0
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.queryStringFromObject = void 0;
exports.queryStringFromObject = function (obj) {
if (!obj || Object.keys(obj).length === 0) return null
var qs =
'?' +
Object.keys(obj)
.filter(function (key) {
return obj[key] !== null && obj[key] !== undefined
})
.filter(function (key) {
return (
typeof obj[key] === 'string' ||
typeof obj[key] === 'number' ||
typeof obj[key] === 'boolean'
)
})
.map(function (key) {
return key + '=' + obj[key]
})
.join('&')
return qs === '?' ? null : qs
}
//# sourceMappingURL=queryStringFromObject.js.map
if (!obj || Object.keys(obj).length === 0)
return null;
var qs = '?' +
Object.keys(obj)
.filter(function (key) { return obj[key] !== null && obj[key] !== undefined; })
.filter(function (key) {
return typeof obj[key] === 'string' ||
typeof obj[key] === 'number' ||
typeof obj[key] === 'boolean';
})
.map(function (key) { return key + "=" + obj[key]; })
.join('&');
return qs === '?' ? null : qs;
};
//# sourceMappingURL=queryStringFromObject.js.map

@@ -1,12 +0,13 @@

'use strict'
Object.defineProperty(exports, '__esModule', { value: true })
exports.toCapitalizeFirstLetter = void 0
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toCapitalizeFirstLetter = void 0;
var toUpperCaseFirstLetter = function (word) {
return word.charAt(0).toUpperCase() + word.slice(1)
}
return word.charAt(0).toUpperCase() + word.slice(1);
};
var toCapitalizeFirstLetter = function (word) {
if (!word) return ''
return word.split(' ').map(toUpperCaseFirstLetter).join(' ')
}
exports.toCapitalizeFirstLetter = toCapitalizeFirstLetter
//# sourceMappingURL=toCapitalizeFirstLetter.js.map
if (!word)
return '';
return word.split(' ').map(toUpperCaseFirstLetter).join(' ');
};
exports.toCapitalizeFirstLetter = toCapitalizeFirstLetter;
//# sourceMappingURL=toCapitalizeFirstLetter.js.map

@@ -1,18 +0,17 @@

'use strict'
Object.defineProperty(exports, '__esModule', { value: true })
exports.toLocaleCapitalizeFirstLetter = void 0
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toLocaleCapitalizeFirstLetter = void 0;
var toLocaleUpperCaseFirstLetter = function (word, locale) {
return word.charAt(0).toLocaleUpperCase(locale) + word.slice(1)
}
return word.charAt(0).toLocaleUpperCase(locale) + word.slice(1);
};
var toLocaleCapitalizeFirstLetter = function (word, locale) {
if (!word) return ''
var localeDefined = locale || navigator.language
return word
.split(' ')
.map(function (item) {
return toLocaleUpperCaseFirstLetter(item, localeDefined)
})
.join(' ')
}
exports.toLocaleCapitalizeFirstLetter = toLocaleCapitalizeFirstLetter
//# sourceMappingURL=toLocaleCapitalizeFirstLetter.js.map
if (!word)
return '';
var localeDefined = locale || navigator.language;
return word
.split(' ')
.map(function (item) { return toLocaleUpperCaseFirstLetter(item, localeDefined); })
.join(' ');
};
exports.toLocaleCapitalizeFirstLetter = toLocaleCapitalizeFirstLetter;
//# sourceMappingURL=toLocaleCapitalizeFirstLetter.js.map
{
"name": "@loadsmart/utils-string",
"private": false,
"version": "0.1.2",
"version": "0.2.0",
"description": "useful functions for manipulating string",

@@ -33,3 +33,3 @@ "keywords": [

},
"gitHead": "85f2b5a0c5467f38b2916c4d9ededf26482c7540"
"gitHead": "2836a552af751c2f10ca6b8affc9f68cdd956b3b"
}

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