@pro-functional/objects
Advanced tools
@@ -1,2 +0,2 @@ | ||
| "use strict";var c=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var x=(n,t)=>{for(var e in t)c(n,e,{get:t[e],enumerable:!0})},b=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of k(t))!u.call(n,o)&&o!==e&&c(n,o,{get:()=>t[o],enumerable:!(s=p(t,o))||s.enumerable});return n};var a=n=>b(c({},"__esModule",{value:!0}),n);var d={};x(d,{checkObject:()=>h,isObject:()=>r,isObjectWithProps:()=>g,matchesEnum:()=>w,matchesString:()=>i});module.exports=a(d);const r=n=>typeof n=="object"&&!!n,g=(n,...t)=>r(n)&&t.every(e=>e in n),h=n=>{const t=(s,o)=>e(o(n[s])),e=s=>({result:s,withProp:t});return e(!!n)},i=n=>typeof n=="string",w=n=>t=>i(t)&&Object.keys(n).includes(t); | ||
| "use strict";var c=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var a=(n,t)=>{for(var e in t)c(n,e,{get:t[e],enumerable:!0})},x=(n,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of k(t))!u.call(n,o)&&o!==e&&c(n,o,{get:()=>t[o],enumerable:!(s=p(t,o))||s.enumerable});return n};var h=n=>x(c({},"__esModule",{value:!0}),n);var g={};a(g,{checkObject:()=>b,isObject:()=>r,isObjectWithProps:()=>y,matchesEnum:()=>w,matchesList:()=>T,matchesString:()=>i});module.exports=h(g);const r=n=>typeof n=="object"&&!!n,y=(n,...t)=>r(n)&&t.every(e=>e in n),b=n=>{const t=(s,o)=>e(o(n[s])),e=s=>({result:s,withProp:t});return e(!!n)},i=n=>typeof n=="string",w=n=>t=>i(t)&&Object.keys(n).includes(t),T=n=>t=>Array.isArray(t)&&t.every(n); | ||
| //# sourceMappingURL=objects.js.map |
| { | ||
| "version": 3, | ||
| "sources": ["../../src/objects.ts"], | ||
| "sourcesContent": ["export const isObject = (value?: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && !!value\n\nexport const isObjectWithProps = <K extends string>(\n value?: unknown,\n ...props: K[]\n): value is { [k in K]: unknown } =>\n isObject(value) && props.every((prop) => prop in value)\n\ntype MatchFunc<T> = (param: T) => boolean\n\nexport const checkObject = <T extends object>(value: T) => {\n const withProp = <K extends keyof T>(key: K, matchFunc: MatchFunc<T[K]>) =>\n next(matchFunc(value[key]))\n\n const next = (result: boolean) => ({ result, withProp })\n\n return next(!!value)\n}\n\nexport const matchesString = (value: unknown): value is string =>\n typeof value === 'string'\n\nexport const matchesEnum =\n (enumerated: Record<string, string>) => (value: unknown) =>\n matchesString(value) && Object.keys(enumerated).includes(value)\n"], | ||
| "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,aAAAC,EAAA,sBAAAC,EAAA,gBAAAC,EAAA,kBAAAC,IAAA,eAAAC,EAAAP,GAAO,MAAMG,EAAYK,GACrB,OAAOA,GAAU,UAAY,CAAC,CAACA,EAEtBJ,EAAoB,CAC7BI,KACGC,IAEHN,EAASK,CAAK,GAAKC,EAAM,MAAOC,GAASA,KAAQF,CAAK,EAI7CN,EAAiCM,GAAa,CACvD,MAAMG,EAAW,CAAoBC,EAAQC,IACzCC,EAAKD,EAAUL,EAAMI,CAAG,CAAC,CAAC,EAExBE,EAAQC,IAAqB,CAAE,OAAAA,EAAQ,SAAAJ,CAAS,GAEtD,OAAOG,EAAK,CAAC,CAACN,CAAK,CACvB,EAEaF,EAAiBE,GAC1B,OAAOA,GAAU,SAERH,EACRW,GAAwCR,GACrCF,EAAcE,CAAK,GAAK,OAAO,KAAKQ,CAAU,EAAE,SAASR,CAAK", | ||
| "names": ["objects_exports", "__export", "checkObject", "isObject", "isObjectWithProps", "matchesEnum", "matchesString", "__toCommonJS", "value", "props", "prop", "withProp", "key", "matchFunc", "next", "result", "enumerated"] | ||
| "sourcesContent": ["export const isObject = (value?: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && !!value\n\nexport const isObjectWithProps = <K extends string>(\n value?: unknown,\n ...props: K[]\n): value is { [k in K]: unknown } =>\n isObject(value) && props.every((prop) => prop in value)\n\ntype MatchFunc<T> = (param: T) => boolean\n\nexport const checkObject = <T extends object>(value: T) => {\n const withProp = <K extends keyof T>(key: K, matchFunc: MatchFunc<T[K]>) =>\n next(matchFunc(value[key]))\n\n const next = (result: boolean) => ({ result, withProp })\n\n return next(!!value)\n}\n\nexport const matchesString = (value: unknown): value is string =>\n typeof value === 'string'\n\nexport const matchesEnum =\n (enumerated: Record<string, string>) => (value: unknown) =>\n matchesString(value) && Object.keys(enumerated).includes(value)\n\nexport const matchesList =\n <T>(matchFunc: MatchFunc<T>) =>\n (value: unknown) =>\n Array.isArray(value) && value.every(matchFunc)\n"], | ||
| "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,aAAAC,EAAA,sBAAAC,EAAA,gBAAAC,EAAA,gBAAAC,EAAA,kBAAAC,IAAA,eAAAC,EAAAR,GAAO,MAAMG,EAAYM,GACrB,OAAOA,GAAU,UAAY,CAAC,CAACA,EAEtBL,EAAoB,CAC7BK,KACGC,IAEHP,EAASM,CAAK,GAAKC,EAAM,MAAOC,GAASA,KAAQF,CAAK,EAI7CP,EAAiCO,GAAa,CACvD,MAAMG,EAAW,CAAoBC,EAAQC,IACzCC,EAAKD,EAAUL,EAAMI,CAAG,CAAC,CAAC,EAExBE,EAAQC,IAAqB,CAAE,OAAAA,EAAQ,SAAAJ,CAAS,GAEtD,OAAOG,EAAK,CAAC,CAACN,CAAK,CACvB,EAEaF,EAAiBE,GAC1B,OAAOA,GAAU,SAERJ,EACRY,GAAwCR,GACrCF,EAAcE,CAAK,GAAK,OAAO,KAAKQ,CAAU,EAAE,SAASR,CAAK,EAEzDH,EACLQ,GACHL,GACG,MAAM,QAAQA,CAAK,GAAKA,EAAM,MAAMK,CAAS", | ||
| "names": ["objects_exports", "__export", "checkObject", "isObject", "isObjectWithProps", "matchesEnum", "matchesList", "matchesString", "__toCommonJS", "value", "props", "prop", "withProp", "key", "matchFunc", "next", "result", "enumerated"] | ||
| } |
@@ -1,2 +0,2 @@ | ||
| const c=n=>typeof n=="object"&&!!n,i=(n,...t)=>c(n)&&t.every(e=>e in n),p=n=>{const t=(o,s)=>e(s(n[o])),e=o=>({result:o,withProp:t});return e(!!n)},r=n=>typeof n=="string",k=n=>t=>r(t)&&Object.keys(n).includes(t);export{p as checkObject,c as isObject,i as isObjectWithProps,k as matchesEnum,r as matchesString}; | ||
| const c=n=>typeof n=="object"&&!!n,i=(n,...t)=>c(n)&&t.every(e=>e in n),p=n=>{const t=(o,s)=>e(s(n[o])),e=o=>({result:o,withProp:t});return e(!!n)},r=n=>typeof n=="string",k=n=>t=>r(t)&&Object.keys(n).includes(t),u=n=>t=>Array.isArray(t)&&t.every(n);export{p as checkObject,c as isObject,i as isObjectWithProps,k as matchesEnum,u as matchesList,r as matchesString}; | ||
| //# sourceMappingURL=objects.js.map |
| { | ||
| "version": 3, | ||
| "sources": ["../../src/objects.ts"], | ||
| "sourcesContent": ["export const isObject = (value?: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && !!value\n\nexport const isObjectWithProps = <K extends string>(\n value?: unknown,\n ...props: K[]\n): value is { [k in K]: unknown } =>\n isObject(value) && props.every((prop) => prop in value)\n\ntype MatchFunc<T> = (param: T) => boolean\n\nexport const checkObject = <T extends object>(value: T) => {\n const withProp = <K extends keyof T>(key: K, matchFunc: MatchFunc<T[K]>) =>\n next(matchFunc(value[key]))\n\n const next = (result: boolean) => ({ result, withProp })\n\n return next(!!value)\n}\n\nexport const matchesString = (value: unknown): value is string =>\n typeof value === 'string'\n\nexport const matchesEnum =\n (enumerated: Record<string, string>) => (value: unknown) =>\n matchesString(value) && Object.keys(enumerated).includes(value)\n"], | ||
| "mappings": "AAAO,MAAMA,EAAYC,GACrB,OAAOA,GAAU,UAAY,CAAC,CAACA,EAEtBC,EAAoB,CAC7BD,KACGE,IAEHH,EAASC,CAAK,GAAKE,EAAM,MAAOC,GAASA,KAAQH,CAAK,EAI7CI,EAAiCJ,GAAa,CACvD,MAAMK,EAAW,CAAoBC,EAAQC,IACzCC,EAAKD,EAAUP,EAAMM,CAAG,CAAC,CAAC,EAExBE,EAAQC,IAAqB,CAAE,OAAAA,EAAQ,SAAAJ,CAAS,GAEtD,OAAOG,EAAK,CAAC,CAACR,CAAK,CACvB,EAEaU,EAAiBV,GAC1B,OAAOA,GAAU,SAERW,EACRC,GAAwCZ,GACrCU,EAAcV,CAAK,GAAK,OAAO,KAAKY,CAAU,EAAE,SAASZ,CAAK", | ||
| "names": ["isObject", "value", "isObjectWithProps", "props", "prop", "checkObject", "withProp", "key", "matchFunc", "next", "result", "matchesString", "matchesEnum", "enumerated"] | ||
| "sourcesContent": ["export const isObject = (value?: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && !!value\n\nexport const isObjectWithProps = <K extends string>(\n value?: unknown,\n ...props: K[]\n): value is { [k in K]: unknown } =>\n isObject(value) && props.every((prop) => prop in value)\n\ntype MatchFunc<T> = (param: T) => boolean\n\nexport const checkObject = <T extends object>(value: T) => {\n const withProp = <K extends keyof T>(key: K, matchFunc: MatchFunc<T[K]>) =>\n next(matchFunc(value[key]))\n\n const next = (result: boolean) => ({ result, withProp })\n\n return next(!!value)\n}\n\nexport const matchesString = (value: unknown): value is string =>\n typeof value === 'string'\n\nexport const matchesEnum =\n (enumerated: Record<string, string>) => (value: unknown) =>\n matchesString(value) && Object.keys(enumerated).includes(value)\n\nexport const matchesList =\n <T>(matchFunc: MatchFunc<T>) =>\n (value: unknown) =>\n Array.isArray(value) && value.every(matchFunc)\n"], | ||
| "mappings": "AAAO,MAAMA,EAAYC,GACrB,OAAOA,GAAU,UAAY,CAAC,CAACA,EAEtBC,EAAoB,CAC7BD,KACGE,IAEHH,EAASC,CAAK,GAAKE,EAAM,MAAOC,GAASA,KAAQH,CAAK,EAI7CI,EAAiCJ,GAAa,CACvD,MAAMK,EAAW,CAAoBC,EAAQC,IACzCC,EAAKD,EAAUP,EAAMM,CAAG,CAAC,CAAC,EAExBE,EAAQC,IAAqB,CAAE,OAAAA,EAAQ,SAAAJ,CAAS,GAEtD,OAAOG,EAAK,CAAC,CAACR,CAAK,CACvB,EAEaU,EAAiBV,GAC1B,OAAOA,GAAU,SAERW,EACRC,GAAwCZ,GACrCU,EAAcV,CAAK,GAAK,OAAO,KAAKY,CAAU,EAAE,SAASZ,CAAK,EAEzDa,EACLN,GACHP,GACG,MAAM,QAAQA,CAAK,GAAKA,EAAM,MAAMO,CAAS", | ||
| "names": ["isObject", "value", "isObjectWithProps", "props", "prop", "checkObject", "withProp", "key", "matchFunc", "next", "result", "matchesString", "matchesEnum", "enumerated", "matchesList"] | ||
| } |
@@ -10,2 +10,3 @@ export declare const isObject: (value?: unknown) => value is Record<string, unknown>; | ||
| export declare const matchesEnum: (enumerated: Record<string, string>) => (value: unknown) => boolean; | ||
| export declare const matchesList: <T>(matchFunc: MatchFunc<T>) => (value: unknown) => boolean; | ||
| export {}; |
+2
-2
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "name": "@pro-functional/objects", | ||
| "version": "0.7.0", | ||
| "version": "0.8.0", | ||
| "author": { | ||
@@ -55,3 +55,3 @@ "name": "Harish Prakash", | ||
| }, | ||
| "gitHead": "27e941fa87f55c37fa2df207e94650c4aaa59c28" | ||
| "gitHead": "e47e90d92f0fe25bc30a9a0f5477bf3080ca0e99" | ||
| } |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
13500
5.19%33
6.45%6
20%