Comparing version 1.6.0 to 1.7.0
declare type ObjectOrArray = Record<string, unknown> | Array<unknown>; | ||
export declare function camelize(str: string): string; | ||
export declare function decamelize(str: string): string; | ||
export declare function decamelize(str: string, sep?: string): string; | ||
export declare function pascalize(str: string): string; | ||
export declare function depascalize(str: string): string; | ||
export declare function depascalize(str: string, sep?: string): string; | ||
export declare function camelizeKeys(obj: ObjectOrArray): any[] | Record<string, unknown>; | ||
export declare function decamelizeKeys(obj: ObjectOrArray): any[] | Record<string, unknown>; | ||
export declare function decamelizeKeys(obj: ObjectOrArray, sep?: string): any[] | Record<string, unknown>; | ||
export declare function pascalizeKeys(obj: ObjectOrArray): any[] | Record<string, unknown>; | ||
export declare function depascalizeKeys(obj: ObjectOrArray): any[] | Record<string, unknown>; | ||
export declare function camelizeKeysInPlace(obj: ObjectOrArray): ObjectOrArray; | ||
export declare function decamelizeKeysInPlace(obj: ObjectOrArray): ObjectOrArray; | ||
export declare function pascalizeKeysInPlace(obj: ObjectOrArray): ObjectOrArray; | ||
export declare function depascalizeKeysInPlace(obj: ObjectOrArray): ObjectOrArray; | ||
export declare function depascalizeKeys(obj: ObjectOrArray, sep?: string): any[] | Record<string, unknown>; | ||
export declare function camelizeKeysInPlace(obj: ObjectOrArray): Record<string, unknown> | unknown[]; | ||
export declare function decamelizeKeysInPlace(obj: ObjectOrArray, sep?: string): Record<string, unknown> | unknown[]; | ||
export declare function pascalizeKeysInPlace(obj: ObjectOrArray): Record<string, unknown> | unknown[]; | ||
export declare function depascalizeKeysInPlace(obj: ObjectOrArray, sep?: string): Record<string, unknown> | unknown[]; | ||
export {}; |
@@ -1,2 +0,2 @@ | ||
function r(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function e(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,void 0);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function t(r){return 65<=r&&r<=90}function n(r){return 97<=r&&r<=122}function o(r){return 48<=r&&r<=57}function a(r){return r-32}function i(r){return r+32}function u(r){var e=r.charCodeAt(0);if(o(e)||45===e||isNaN(e))return r;for(var u=t(e),c=u?[i(e)]:[e],f=r.length,s=1;s<f;s++){var l=r.charCodeAt(s);if(95===l||32===l||45===l){if(u=!0,l=r.charCodeAt(++s),isNaN(l))return r;n(l)?c.push(a(l)):c.push(l)}else c.push(l)}return u?String.fromCharCode.apply(void 0,c):r}function c(r){var e=r.charCodeAt(0);if(!n(e)||isNaN(e))return r;for(var o=!1,a=[e],u=r.length,c=1;c<u;c++){var f=r.charCodeAt(c);t(f)?(o=!0,a.push(95),a.push(i(f))):a.push(f)}return o?String.fromCharCode.apply(void 0,a):r}function f(r){var e=r.charCodeAt(0);if(o(e)||45===e||isNaN(e))return r;for(var t=n(e),i=t?[a(e)]:[e],u=r.length,c=1;c<u;c++){var f=r.charCodeAt(c);if(95===f||32===f||45===f){if(t=!0,f=r.charCodeAt(++c),isNaN(f))return r;n(f)?i.push(a(f)):i.push(f)}else i.push(f)}return t?String.fromCharCode.apply(void 0,i):r}function s(r){var e=r.charCodeAt(0);if(!t(e)||isNaN(e))return r;for(var n=[i(e)],o=r.length,a=1;a<o;a++){var u=r.charCodeAt(a);t(u)?(n.push(95),n.push(i(u))):n.push(u)}return String.fromCharCode.apply(void 0,n)}function l(r){return r&&"object"==typeof r&&!(r instanceof Function)&&!(r instanceof Date)}function p(r,t){if(Array.isArray(r))return function(r,t){for(var n,o=new Array(r.length),a=0,i=e(r);!(n=i()).done;){var u=n.value;o[a++]=l(u)?p(u,t):u}return o}(r,t);if(void 0!==r.prototype)return r;var n={};for(var o in r){var a=r[o];n[t(o)]=l(a)?p(a,t):a}return n}function d(r,t){if(Array.isArray(r))return function(r,t){for(var n,o=0,a=e(r);!(n=a()).done;){var i=n.value;r[o++]=l(i)?d(i,t):i}return r}(r,t);for(var n in r){var o=r[n],a=t(n);a!==n&&delete r[n],r[a]=l(o)?d(o,t):o}return r}exports.camelize=u,exports.camelizeKeys=function(r){return l(r)?p(r,u):r},exports.camelizeKeysInPlace=function(r){return l(r)?d(r,u):r},exports.decamelize=c,exports.decamelizeKeys=function(r){return l(r)?p(r,c):r},exports.decamelizeKeysInPlace=function(r){return l(r)?d(r,c):r},exports.depascalize=s,exports.depascalizeKeys=function(r){return l(r)?p(r,s):r},exports.depascalizeKeysInPlace=function(r){return l(r)?d(r,s):r},exports.pascalize=f,exports.pascalizeKeys=function(r){return l(r)?p(r,f):r},exports.pascalizeKeysInPlace=function(r){return l(r)?d(r,f):r}; | ||
function r(r,e){(null==e||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function e(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}function t(r){return 65<=r&&r<=90}function n(r){return 97<=r&&r<=122}function o(r){return 48<=r&&r<=57}function a(r){return r-32}function i(r){return r+32}function u(r){var e=r.charCodeAt(0);if(o(e)||45===e||isNaN(e))return r;for(var u=t(e),c=u?[i(e)]:[e],f=r.length,s=1;s<f;s++){var l=r.charCodeAt(s);if(95===l||32===l||45===l){if(u=!0,l=r.charCodeAt(++s),isNaN(l))return r;n(l)?c.push(a(l)):c.push(l)}else c.push(l)}return u?String.fromCharCode.apply(void 0,c):r}function c(r,e){var o=r.charCodeAt(0);if(!n(o)||isNaN(o))return r;var a=!1,u=[o],c=95;e&&e.charCodeAt(0)&&(c=e.charCodeAt(0));for(var f=r.length,s=1;s<f;s++){var l=r.charCodeAt(s);t(l)?(a=!0,u.push(c),u.push(i(l))):u.push(l)}return a?String.fromCharCode.apply(void 0,u):r}function f(r){var e=r.charCodeAt(0);if(o(e)||45===e||isNaN(e))return r;for(var t=n(e),i=t?[a(e)]:[e],u=r.length,c=1;c<u;c++){var f=r.charCodeAt(c);if(95===f||32===f||45===f){if(t=!0,f=r.charCodeAt(++c),isNaN(f))return r;n(f)?i.push(a(f)):i.push(f)}else i.push(f)}return t?String.fromCharCode.apply(void 0,i):r}function s(r,e){var n=r.charCodeAt(0);if(!t(n)||isNaN(n))return r;var o=[i(n)],a=95;e&&e.charCodeAt(0)&&(a=e.charCodeAt(0));for(var u=r.length,c=1;c<u;c++){var f=r.charCodeAt(c);t(f)?(o.push(a),o.push(i(f))):o.push(f)}return String.fromCharCode.apply(void 0,o)}function l(r){return Boolean(r)&&"object"==typeof r&&!(r instanceof Function)&&!(r instanceof Date)}function p(r,t,n){if(Array.isArray(r))return function(r,t,n){for(var o,a=new Array(r.length),i=0,u=e(r);!(o=u()).done;){var c=o.value;a[i++]=l(c)?p(c,t,n):c}return a}(r,t,n);if(void 0!==r.prototype)return r;var o={};for(var a in r){var i=r[a];o[t(a,n)]=l(i)?p(i,t,n):i}return o}function d(r,t,n){if(Array.isArray(r))return function(r,t,n){for(var o,a=0,i=e(r);!(o=i()).done;){var u=o.value;r[a++]=l(u)?d(u,t,n):u}return r}(r,t,n);for(var o in r){var a=r[o],i=t(o,n);i!==o&&delete r[o],r[i]=l(a)?d(a,t,n):a}return r}exports.camelize=u,exports.camelizeKeys=function(r){return l(r)?p(r,u):r},exports.camelizeKeysInPlace=function(r){return l(r)?d(r,u):r},exports.decamelize=c,exports.decamelizeKeys=function(r,e){return l(r)?p(r,c,e):r},exports.decamelizeKeysInPlace=function(r,e){return l(r)?d(r,c,e):r},exports.depascalize=s,exports.depascalizeKeys=function(r,e){return l(r)?p(r,s,e):r},exports.depascalizeKeysInPlace=function(r,e){return l(r)?d(r,s,e):r},exports.pascalize=f,exports.pascalizeKeys=function(r){return l(r)?p(r,f):r},exports.pascalizeKeysInPlace=function(r){return l(r)?d(r,f):r}; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
function n(n){return 65<=n&&n<=90}function t(n){return 97<=n&&n<=122}function r(n){return 48<=n&&n<=57}function o(n){return n-32}function e(n){return n+32}function u(u){const i=u.charCodeAt(0);if(r(i)||45===i||isNaN(i))return u;let c=n(i);const f=c?[e(i)]:[i],s=u.length;for(let n=1;n<s;n++){let r=u.charCodeAt(n);if(95===r||32===r||45===r){if(c=!0,r=u.charCodeAt(++n),isNaN(r))return u;t(r)?f.push(o(r)):f.push(r)}else f.push(r)}return c?String.fromCharCode.apply(void 0,f):u}function i(r){const o=r.charCodeAt(0);if(!t(o)||isNaN(o))return r;let u=!1;const i=[o],c=r.length;for(let t=1;t<c;t++){const o=r.charCodeAt(t);n(o)?(u=!0,i.push(95),i.push(e(o))):i.push(o)}return u?String.fromCharCode.apply(void 0,i):r}function c(n){const e=n.charCodeAt(0);if(r(e)||45===e||isNaN(e))return n;let u=t(e);const i=u?[o(e)]:[e],c=n.length;for(let r=1;r<c;r++){let e=n.charCodeAt(r);if(95===e||32===e||45===e){if(u=!0,e=n.charCodeAt(++r),isNaN(e))return n;t(e)?i.push(o(e)):i.push(e)}else i.push(e)}return u?String.fromCharCode.apply(void 0,i):n}function f(t){const r=t.charCodeAt(0);if(!n(r)||isNaN(r))return t;const o=[e(r)],u=t.length;for(let r=1;r<u;r++){const u=t.charCodeAt(r);n(u)?(o.push(95),o.push(e(u))):o.push(u)}return String.fromCharCode.apply(void 0,o)}function s(n){return n&&"object"==typeof n&&!(n instanceof Function)&&!(n instanceof Date)}function a(n,t){if(Array.isArray(n))return function(n,t){const r=new Array(n.length);let o=0;for(const e of n)r[o++]=s(e)?a(e,t):e;return r}(n,t);if(void 0!==n.prototype)return n;const r={};for(const o in n){const e=n[o];r[t(o)]=s(e)?a(e,t):e}return r}function h(n,t){if(Array.isArray(n))return function(n,t){let r=0;for(const o of n)n[r++]=s(o)?h(o,t):o;return n}(n,t);for(const r in n){const o=n[r],e=t(r);e!==r&&delete n[r],n[e]=s(o)?h(o,t):o}return n}function p(n){return s(n)?a(n,u):n}function l(n){return s(n)?a(n,i):n}function d(n){return s(n)?a(n,c):n}function C(n){return s(n)?a(n,f):n}function A(n){return s(n)?h(n,u):n}function N(n){return s(n)?h(n,i):n}function y(n){return s(n)?h(n,c):n}function g(n){return s(n)?h(n,f):n}export{u as camelize,p as camelizeKeys,A as camelizeKeysInPlace,i as decamelize,l as decamelizeKeys,N as decamelizeKeysInPlace,f as depascalize,C as depascalizeKeys,g as depascalizeKeysInPlace,c as pascalize,d as pascalizeKeys,y as pascalizeKeysInPlace}; | ||
function t(t){return 65<=t&&t<=90}function n(t){return 97<=t&&t<=122}function r(t){return 48<=t&&t<=57}function o(t){return t-32}function e(t){return t+32}function u(u){const c=u.charCodeAt(0);if(r(c)||45===c||isNaN(c))return u;let i=t(c);const f=i?[e(c)]:[c],s=u.length;for(let t=1;t<s;t++){let r=u.charCodeAt(t);if(95===r||32===r||45===r){if(i=!0,r=u.charCodeAt(++t),isNaN(r))return u;n(r)?f.push(o(r)):f.push(r)}else f.push(r)}return i?String.fromCharCode.apply(void 0,f):u}function c(r,o){const u=r.charCodeAt(0);if(!n(u)||isNaN(u))return r;let c=!1;const i=[u];let f=95;o&&o.charCodeAt(0)&&(f=o.charCodeAt(0));const s=r.length;for(let n=1;n<s;n++){const o=r.charCodeAt(n);t(o)?(c=!0,i.push(f),i.push(e(o))):i.push(o)}return c?String.fromCharCode.apply(void 0,i):r}function i(t){const e=t.charCodeAt(0);if(r(e)||45===e||isNaN(e))return t;let u=n(e);const c=u?[o(e)]:[e],i=t.length;for(let r=1;r<i;r++){let e=t.charCodeAt(r);if(95===e||32===e||45===e){if(u=!0,e=t.charCodeAt(++r),isNaN(e))return t;n(e)?c.push(o(e)):c.push(e)}else c.push(e)}return u?String.fromCharCode.apply(void 0,c):t}function f(n,r){const o=n.charCodeAt(0);if(!t(o)||isNaN(o))return n;const u=[e(o)];let c=95;r&&r.charCodeAt(0)&&(c=r.charCodeAt(0));const i=n.length;for(let r=1;r<i;r++){const o=n.charCodeAt(r);t(o)?(u.push(c),u.push(e(o))):u.push(o)}return String.fromCharCode.apply(void 0,u)}function s(t){return Boolean(t)&&"object"==typeof t&&!(t instanceof Function)&&!(t instanceof Date)}function a(t,n,r){if(Array.isArray(t))return function(t,n,r){const o=new Array(t.length);let e=0;for(const u of t)o[e++]=s(u)?a(u,n,r):u;return o}(t,n,r);if(void 0!==t.prototype)return t;const o={};for(const e in t){const u=t[e];o[n(e,r)]=s(u)?a(u,n,r):u}return o}function h(t,n,r){if(Array.isArray(t))return function(t,n,r){let o=0;for(const e of t)t[o++]=s(e)?h(e,n,r):e;return t}(t,n,r);for(const o in t){const e=t[o],u=n(o,r);u!==o&&delete t[o],t[u]=s(e)?h(e,n,r):e}return t}function l(t){return s(t)?a(t,u):t}function d(t,n){return s(t)?a(t,c,n):t}function p(t){return s(t)?a(t,i):t}function C(t,n){return s(t)?a(t,f,n):t}function A(t){return s(t)?h(t,u):t}function N(t,n){return s(t)?h(t,c,n):t}function y(t){return s(t)?h(t,i):t}function g(t,n){return s(t)?h(t,f,n):t}export{u as camelize,l as camelizeKeys,A as camelizeKeysInPlace,c as decamelize,d as decamelizeKeys,N as decamelizeKeysInPlace,f as depascalize,C as depascalizeKeys,g as depascalizeKeysInPlace,i as pascalize,p as pascalizeKeys,y as pascalizeKeysInPlace}; | ||
//# sourceMappingURL=index.modern.js.map |
@@ -1,2 +0,2 @@ | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((r=r||self).fastCase={})}(this,function(r){function e(r,e){(null==e||e>r.length)&&(e=r.length);for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}function n(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=function(r,n){if(r){if("string"==typeof r)return e(r,void 0);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?e(r,void 0):void 0}}(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=r[Symbol.iterator]()).next.bind(t)}function t(r){return 65<=r&&r<=90}function o(r){return 97<=r&&r<=122}function a(r){return 48<=r&&r<=57}function i(r){return r-32}function u(r){return r+32}function f(r){var e=r.charCodeAt(0);if(a(e)||45===e||isNaN(e))return r;for(var n=t(e),f=n?[u(e)]:[e],c=r.length,s=1;s<c;s++){var l=r.charCodeAt(s);if(95===l||32===l||45===l){if(n=!0,l=r.charCodeAt(++s),isNaN(l))return r;o(l)?f.push(i(l)):f.push(l)}else f.push(l)}return n?String.fromCharCode.apply(void 0,f):r}function c(r){var e=r.charCodeAt(0);if(!o(e)||isNaN(e))return r;for(var n=!1,a=[e],i=r.length,f=1;f<i;f++){var c=r.charCodeAt(f);t(c)?(n=!0,a.push(95),a.push(u(c))):a.push(c)}return n?String.fromCharCode.apply(void 0,a):r}function s(r){var e=r.charCodeAt(0);if(a(e)||45===e||isNaN(e))return r;for(var n=o(e),t=n?[i(e)]:[e],u=r.length,f=1;f<u;f++){var c=r.charCodeAt(f);if(95===c||32===c||45===c){if(n=!0,c=r.charCodeAt(++f),isNaN(c))return r;o(c)?t.push(i(c)):t.push(c)}else t.push(c)}return n?String.fromCharCode.apply(void 0,t):r}function l(r){var e=r.charCodeAt(0);if(!t(e)||isNaN(e))return r;for(var n=[u(e)],o=r.length,a=1;a<o;a++){var i=r.charCodeAt(a);t(i)?(n.push(95),n.push(u(i))):n.push(i)}return String.fromCharCode.apply(void 0,n)}function d(r){return r&&"object"==typeof r&&!(r instanceof Function)&&!(r instanceof Date)}function p(r,e){if(Array.isArray(r))return function(r,e){for(var t,o=new Array(r.length),a=0,i=n(r);!(t=i()).done;){var u=t.value;o[a++]=d(u)?p(u,e):u}return o}(r,e);if(void 0!==r.prototype)return r;var t={};for(var o in r){var a=r[o];t[e(o)]=d(a)?p(a,e):a}return t}function h(r,e){if(Array.isArray(r))return function(r,e){for(var t,o=0,a=n(r);!(t=a()).done;){var i=t.value;r[o++]=d(i)?h(i,e):i}return r}(r,e);for(var t in r){var o=r[t],a=e(t);a!==t&&delete r[t],r[a]=d(o)?h(o,e):o}return r}r.camelize=f,r.camelizeKeys=function(r){return d(r)?p(r,f):r},r.camelizeKeysInPlace=function(r){return d(r)?h(r,f):r},r.decamelize=c,r.decamelizeKeys=function(r){return d(r)?p(r,c):r},r.decamelizeKeysInPlace=function(r){return d(r)?h(r,c):r},r.depascalize=l,r.depascalizeKeys=function(r){return d(r)?p(r,l):r},r.depascalizeKeysInPlace=function(r){return d(r)?h(r,l):r},r.pascalize=s,r.pascalizeKeys=function(r){return d(r)?p(r,s):r},r.pascalizeKeysInPlace=function(r){return d(r)?h(r,s):r}}); | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((r||self).fastCase={})}(this,function(r){function e(r,e){(null==e||e>r.length)&&(e=r.length);for(var n=0,t=new Array(e);n<e;n++)t[n]=r[n];return t}function n(r,n){var t;if("undefined"==typeof Symbol||null==r[Symbol.iterator]){if(Array.isArray(r)||(t=function(r,n){if(r){if("string"==typeof r)return e(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?e(r,n):void 0}}(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(t=r[Symbol.iterator]()).next.bind(t)}function t(r){return 65<=r&&r<=90}function o(r){return 97<=r&&r<=122}function a(r){return 48<=r&&r<=57}function i(r){return r-32}function u(r){return r+32}function f(r){var e=r.charCodeAt(0);if(a(e)||45===e||isNaN(e))return r;for(var n=t(e),f=n?[u(e)]:[e],c=r.length,l=1;l<c;l++){var s=r.charCodeAt(l);if(95===s||32===s||45===s){if(n=!0,s=r.charCodeAt(++l),isNaN(s))return r;o(s)?f.push(i(s)):f.push(s)}else f.push(s)}return n?String.fromCharCode.apply(void 0,f):r}function c(r,e){var n=r.charCodeAt(0);if(!o(n)||isNaN(n))return r;var a=!1,i=[n],f=95;e&&e.charCodeAt(0)&&(f=e.charCodeAt(0));for(var c=r.length,l=1;l<c;l++){var s=r.charCodeAt(l);t(s)?(a=!0,i.push(f),i.push(u(s))):i.push(s)}return a?String.fromCharCode.apply(void 0,i):r}function l(r){var e=r.charCodeAt(0);if(a(e)||45===e||isNaN(e))return r;for(var n=o(e),t=n?[i(e)]:[e],u=r.length,f=1;f<u;f++){var c=r.charCodeAt(f);if(95===c||32===c||45===c){if(n=!0,c=r.charCodeAt(++f),isNaN(c))return r;o(c)?t.push(i(c)):t.push(c)}else t.push(c)}return n?String.fromCharCode.apply(void 0,t):r}function s(r,e){var n=r.charCodeAt(0);if(!t(n)||isNaN(n))return r;var o=[u(n)],a=95;e&&e.charCodeAt(0)&&(a=e.charCodeAt(0));for(var i=r.length,f=1;f<i;f++){var c=r.charCodeAt(f);t(c)?(o.push(a),o.push(u(c))):o.push(c)}return String.fromCharCode.apply(void 0,o)}function d(r){return Boolean(r)&&"object"==typeof r&&!(r instanceof Function)&&!(r instanceof Date)}function h(r,e,t){if(Array.isArray(r))return function(r,e,t){for(var o,a=new Array(r.length),i=0,u=n(r);!(o=u()).done;){var f=o.value;a[i++]=d(f)?h(f,e,t):f}return a}(r,e,t);if(void 0!==r.prototype)return r;var o={};for(var a in r){var i=r[a];o[e(a,t)]=d(i)?h(i,e,t):i}return o}function p(r,e,t){if(Array.isArray(r))return function(r,e,t){for(var o,a=0,i=n(r);!(o=i()).done;){var u=o.value;r[a++]=d(u)?p(u,e,t):u}return r}(r,e,t);for(var o in r){var a=r[o],i=e(o,t);i!==o&&delete r[o],r[i]=d(a)?p(a,e,t):a}return r}r.camelize=f,r.camelizeKeys=function(r){return d(r)?h(r,f):r},r.camelizeKeysInPlace=function(r){return d(r)?p(r,f):r},r.decamelize=c,r.decamelizeKeys=function(r,e){return d(r)?h(r,c,e):r},r.decamelizeKeysInPlace=function(r,e){return d(r)?p(r,c,e):r},r.depascalize=s,r.depascalizeKeys=function(r,e){return d(r)?h(r,s,e):r},r.depascalizeKeysInPlace=function(r,e){return d(r)?p(r,s,e):r},r.pascalize=l,r.pascalizeKeys=function(r){return d(r)?h(r,l):r},r.pascalizeKeysInPlace=function(r){return d(r)?p(r,l):r}}); | ||
//# sourceMappingURL=index.umd.js.map |
{ | ||
"name": "fast-case", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "A fast JS library for camelCase and PascalCase", | ||
@@ -31,10 +31,10 @@ "author": "Jacob Gillespie <jacobwgillespie@gmail.com>", | ||
"devDependencies": { | ||
"ava": "^3.9.0", | ||
"ava": "^4.0.0", | ||
"benchmark": "^2.1.4", | ||
"humps": "^2.0.1", | ||
"microbundle": "^0.12.1", | ||
"microbundle": "^0.14.0", | ||
"prettier": "^2.0.5", | ||
"typescript": "^3.9.6", | ||
"typescript": "^4.0.2", | ||
"xcase": "^2.0.1" | ||
} | ||
} |
@@ -39,2 +39,6 @@ # ⚡ fast-case | ||
// Optional custom separator | ||
// 'aString' -> 'a-string' | ||
decamelize(string, '-') | ||
// 'a_string' -> 'AString' | ||
@@ -46,2 +50,6 @@ pascalize(string) | ||
// Optional custom separator | ||
// 'AString' -> 'a-string' | ||
depascalize(string, '-') | ||
// Camelize all object keys (recursive), | ||
@@ -66,2 +74,9 @@ // optionally modify the object in-place. | ||
depascalizeKeysInPlace(obj) | ||
// Optional custom separator for decamelizeKeys, | ||
// depascalizeKeys, and in-place variants. | ||
decamelizeKeys(obj, '-') | ||
decamelizeKeysInPlace(obj, '-') | ||
depascalizeKeys(obj, '-') | ||
depascalizeKeysInPlace(obj, '-') | ||
``` | ||
@@ -74,52 +89,52 @@ | ||
``` | ||
xcase#camelize x 5,743,288 ops/sec ±0.84% (179 runs sampled) | ||
fastCase#camelize x 6,830,633 ops/sec ±0.79% (182 runs sampled) | ||
humps#camelize x 867,373 ops/sec ±1.01% (180 runs sampled) | ||
xcase#camelize x 6,600,243 ops/sec ±0.72% (191 runs sampled) | ||
fastCase#camelize x 7,716,825 ops/sec ±0.78% (190 runs sampled) | ||
humps#camelize x 1,150,491 ops/sec ±0.54% (191 runs sampled) | ||
Fastest is fastCase#camelize | ||
xcase#decamelize x 5,223,684 ops/sec ±1.37% (181 runs sampled) | ||
fastCase#decamelize x 5,329,052 ops/sec ±0.88% (183 runs sampled) | ||
humps#decamelize x 1,559,349 ops/sec ±0.82% (183 runs sampled) | ||
xcase#decamelize x 6,095,752 ops/sec ±0.63% (192 runs sampled) | ||
fastCase#decamelize x 6,251,767 ops/sec ±0.73% (192 runs sampled) | ||
humps#decamelize x 2,087,936 ops/sec ±0.94% (189 runs sampled) | ||
Fastest is fastCase#decamelize | ||
xcase#pascalize x 5,528,203 ops/sec ±0.86% (179 runs sampled) | ||
fastCase#pascalize x 6,206,861 ops/sec ±0.94% (181 runs sampled) | ||
humps#pascalize x 760,483 ops/sec ±0.78% (181 runs sampled) | ||
xcase#pascalize x 6,623,570 ops/sec ±0.77% (188 runs sampled) | ||
fastCase#pascalize x 7,438,234 ops/sec ±0.74% (188 runs sampled) | ||
humps#pascalize x 1,060,071 ops/sec ±0.66% (192 runs sampled) | ||
Fastest is fastCase#pascalize | ||
xcase#depascalize x 5,083,156 ops/sec ±0.76% (181 runs sampled) | ||
fastCase#depascalize x 5,002,102 ops/sec ±0.93% (182 runs sampled) | ||
humps#depascalize x 1,435,249 ops/sec ±0.71% (184 runs sampled) | ||
xcase#depascalize x 6,207,477 ops/sec ±0.57% (191 runs sampled) | ||
fastCase#depascalize x 6,130,597 ops/sec ±0.73% (186 runs sampled) | ||
humps#depascalize x 1,909,126 ops/sec ±0.93% (190 runs sampled) | ||
Fastest is xcase#depascalize | ||
xcase#camelizeKeys x 553,915 ops/sec ±0.90% (183 runs sampled) | ||
fastCase#camelizeKeys x 586,491 ops/sec ±0.81% (182 runs sampled) | ||
humps#camelizeKeys x 174,884 ops/sec ±0.70% (183 runs sampled) | ||
xcase#camelizeKeys x 749,311 ops/sec ±0.68% (190 runs sampled) | ||
fastCase#camelizeKeys x 794,874 ops/sec ±0.72% (191 runs sampled) | ||
humps#camelizeKeys x 224,859 ops/sec ±0.52% (191 runs sampled) | ||
Fastest is fastCase#camelizeKeys | ||
xcase#camelizeKeys (in place) x 649,486 ops/sec ±0.80% (172 runs sampled) | ||
fastCase#camelizeKeysInPlace (in place) x 639,780 ops/sec ±0.87% (182 runs sampled) | ||
Fastest is xcase#camelizeKeys (in place) | ||
xcase#camelizeKeys (in place) x 835,931 ops/sec ±0.75% (190 runs sampled) | ||
fastCase#camelizeKeysInPlace (in place) x 844,663 ops/sec ±0.88% (191 runs sampled) | ||
Fastest is fastCase#camelizeKeysInPlace (in place) | ||
xcase#decamelizeKeys x 592,740 ops/sec ±0.94% (181 runs sampled) | ||
fastCase#decamelizeKeys x 594,536 ops/sec ±0.97% (184 runs sampled) | ||
humps#decamelizeKeys x 283,610 ops/sec ±0.89% (180 runs sampled) | ||
Fastest is fastCase#decamelizeKeys,xcase#decamelizeKeys | ||
xcase#decamelizeKeys x 812,360 ops/sec ±0.86% (191 runs sampled) | ||
fastCase#decamelizeKeys x 786,222 ops/sec ±0.69% (189 runs sampled) | ||
humps#decamelizeKeys x 378,324 ops/sec ±0.70% (192 runs sampled) | ||
Fastest is xcase#decamelizeKeys | ||
xcase#camelizeKeys (large object) x 651 ops/sec ±0.92% (178 runs sampled) | ||
fastCase#camelizeKeys (large object) x 765 ops/sec ±0.99% (175 runs sampled) | ||
humps#camelizeKeys (large object) x 216 ops/sec ±0.94% (173 runs sampled) | ||
xcase#camelizeKeys (large object) x 822 ops/sec ±0.77% (187 runs sampled) | ||
fastCase#camelizeKeys (large object) x 962 ops/sec ±1.16% (185 runs sampled) | ||
humps#camelizeKeys (large object) x 282 ops/sec ±0.79% (185 runs sampled) | ||
Fastest is fastCase#camelizeKeys (large object) | ||
xcase#camelizeKeys (in place) (large object) x 549 ops/sec ±1.44% (172 runs sampled) | ||
fastCase#camelizeKeysInPlace (in place) (large object) x 797 ops/sec ±0.87% (178 runs sampled) | ||
xcase#camelizeKeys (in place) (large object) x 688 ops/sec ±1.28% (181 runs sampled) | ||
fastCase#camelizeKeysInPlace (in place) (large object) x 1,011 ops/sec ±0.59% (189 runs sampled) | ||
Fastest is fastCase#camelizeKeysInPlace (in place) (large object) | ||
xcase#pascalizeKeys (large object) x 440 ops/sec ±0.77% (180 runs sampled) | ||
fastCase#pascalizeKeys (large object) x 528 ops/sec ±0.78% (179 runs sampled) | ||
humps#pascalizeKeys (large object) x 254 ops/sec ±0.86% (174 runs sampled) | ||
xcase#pascalizeKeys (large object) x 589 ops/sec ±0.60% (183 runs sampled) | ||
fastCase#pascalizeKeys (large object) x 680 ops/sec ±0.97% (186 runs sampled) | ||
humps#pascalizeKeys (large object) x 338 ops/sec ±0.72% (181 runs sampled) | ||
Fastest is fastCase#pascalizeKeys (large object) | ||
xcase#pascalizeKeys (in place) (large object) x 836 ops/sec ±0.93% (178 runs sampled) | ||
fastCase#pascalizeKeysInPlace (in place) (large object) x 1,099 ops/sec ±1.02% (176 runs sampled) | ||
xcase#pascalizeKeys (in place) (large object) x 1,007 ops/sec ±0.79% (183 runs sampled) | ||
fastCase#pascalizeKeysInPlace (in place) (large object) x 1,356 ops/sec ±0.75% (188 runs sampled) | ||
Fastest is fastCase#pascalizeKeysInPlace (in place) (large object) | ||
@@ -126,0 +141,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50885
53
149
10