New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@cpmech/basic

Package Overview
Dependencies
Maintainers
1
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cpmech/basic - npm Package Compare versions

Comparing version 2.9.0 to 2.9.1

dist/esm/Locales.d.ts

2

dist/cjs/index.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const filled=e=>""!==e&&"null"!==e,allFilled=(e,r)=>{let t;t=r?Object.keys(e).filter(e=>!r.includes(e)):Object.keys(e);for(const r of t)if(!filled(e[r]))return!1;return!0},camelize=(e,r=!1,t="_")=>r?e.split(t).map(e=>e.toLowerCase().replace(/./,e=>e.toUpperCase())).join(""):e.split(t).map((e,r)=>r>0?e.toLowerCase().replace(/./,e=>e.toUpperCase()):e.toLowerCase()).join(""),email2key=e=>e.toLowerCase().replace(/[@\.]/g,"_"),getObjectKeys=(e,r=!0)=>{const t=[];for(const[o,l]of Object.entries(e))t.push(o),"object"!=typeof l||Array.isArray(l)||(r&&t.push("{"),getObjectKeys(l,r).forEach(e=>t.push(e)),r&&t.push("}"));return t},hasProp=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),makeGetField=(e,r)=>t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`cannot find ${t}`);const o=e[t];if(typeof o!==r)throw new Error(`type of ${t} is incorrect`);return o},makeSetField=(e,r,t)=>(o,l)=>{if(!Object.prototype.hasOwnProperty.call(e,o))throw new Error(`cannot find ${o}`);const s=e[o];if(typeof s!==t)throw new Error(`type of ${o} is incorrect`);s!==l&&(e[o]=l,r())},numOnly=e=>e.replace(/[\D\s\._\-]+/g,""),sleep=e=>new Promise(r=>setTimeout(r,e)),shallowCompareArrays=(e,r)=>{if(e.length!==r.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==r[t])return!1;return!0};exports.allFilled=allFilled,exports.camelize=camelize,exports.email2key=email2key,exports.filled=filled,exports.getObjectKeys=getObjectKeys,exports.hasProp=hasProp,exports.makeGetField=makeGetField,exports.makeSetField=makeSetField,exports.numOnly=numOnly,exports.shallowCompareArrays=shallowCompareArrays,exports.sleep=sleep;
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});const filled=e=>""!==e&&"null"!==e,allFilled=(e,t)=>{let r;r=t?Object.keys(e).filter(e=>!t.includes(e)):Object.keys(e);for(const t of r)if(!filled(e[t]))return!1;return!0},camelize=(e,t=!1,r="_")=>t?e.split(r).map(e=>e.toLowerCase().replace(/./,e=>e.toUpperCase())).join(""):e.split(r).map((e,t)=>t>0?e.toLowerCase().replace(/./,e=>e.toUpperCase()):e.toLowerCase()).join(""),email2key=e=>e.toLowerCase().replace(/[@\.]/g,"_"),getObjectKeys=(e,t=!0)=>{const r=[];for(const[s,o]of Object.entries(e))r.push(s),"object"!=typeof o||Array.isArray(o)||(t&&r.push("{"),getObjectKeys(o,t).forEach(e=>r.push(e)),t&&r.push("}"));return r},hasProp=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);class Locales{constructor(e,t="en",r="us"){this.getLocale=()=>this.locale,this.setLocale=e=>this.locale=e,this.getCountry=()=>this.country,this.setCountry=e=>this.country=e,this.getIndexDay=()=>"us"===this.country?1:0,this.getIndexMonth=()=>"us"===this.country?0:1,this.getFirstFieldMax=()=>"us"===this.country?12:31,this.getSecondFieldMax=()=>"us"===this.country?31:12,this.getDateFormat=()=>"us"===this.country?"MM/DD/YYYY":"DD/MM/YYYY",this.translate=(e,t="")=>{if(!hasProp(this.resources,this.locale))return`INTERNAL_ERROR: cannot find locale ${this.locale} in resources object`;const r=this.resources[this.locale];if(!e)return"INTERNAL_ERROR: path variable must not be empty";const s=e.split(".").reduce((e,t)=>hasProp(e,t)?e[t]:"",r);return s||(t||`INTERNAL_ERROR: cannot find message with path = ${e}`)},this.resources=e,this.locale=t,this.country=r}}const makeGetField=(e,t)=>r=>{if(!Object.prototype.hasOwnProperty.call(e,r))throw new Error(`cannot find ${r}`);const s=e[r];if(typeof s!==t)throw new Error(`type of ${r} is incorrect`);return s},makeSetField=(e,t,r)=>(s,o)=>{if(!Object.prototype.hasOwnProperty.call(e,s))throw new Error(`cannot find ${s}`);const l=e[s];if(typeof l!==r)throw new Error(`type of ${s} is incorrect`);l!==o&&(e[s]=o,t())},numOnly=e=>e.replace(/[\D\s\._\-]+/g,""),sleep=e=>new Promise(t=>setTimeout(t,e)),shallowCompareArrays=(e,t)=>{if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0};exports.Locales=Locales,exports.allFilled=allFilled,exports.camelize=camelize,exports.email2key=email2key,exports.filled=filled,exports.getObjectKeys=getObjectKeys,exports.hasProp=hasProp,exports.makeGetField=makeGetField,exports.makeSetField=makeSetField,exports.numOnly=numOnly,exports.shallowCompareArrays=shallowCompareArrays,exports.sleep=sleep;

@@ -7,2 +7,3 @@ export * from './allFilled';

export * from './hasProp';
export * from './Locales';
export * from './makeGetField';

@@ -9,0 +10,0 @@ export * from './makeSetField';

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

const e=e=>""!==e&&"null"!==e,r=(r,t)=>{let o;o=t?Object.keys(r).filter(e=>!t.includes(e)):Object.keys(r);for(const t of o)if(!e(r[t]))return!1;return!0},t=(e,r=!1,t="_")=>r?e.split(t).map(e=>e.toLowerCase().replace(/./,e=>e.toUpperCase())).join(""):e.split(t).map((e,r)=>r>0?e.toLowerCase().replace(/./,e=>e.toUpperCase()):e.toLowerCase()).join(""),o=e=>e.toLowerCase().replace(/[@\.]/g,"_"),n=(e,r=!0)=>{const t=[];for(const[o,p]of Object.entries(e))t.push(o),"object"!=typeof p||Array.isArray(p)||(r&&t.push("{"),n(p,r).forEach(e=>t.push(e)),r&&t.push("}"));return t},p=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),s=(e,r)=>t=>{if(!Object.prototype.hasOwnProperty.call(e,t))throw new Error(`cannot find ${t}`);const o=e[t];if(typeof o!==r)throw new Error(`type of ${t} is incorrect`);return o},c=(e,r,t)=>(o,n)=>{if(!Object.prototype.hasOwnProperty.call(e,o))throw new Error(`cannot find ${o}`);const p=e[o];if(typeof p!==t)throw new Error(`type of ${o} is incorrect`);p!==n&&(e[o]=n,r())},a=e=>e.replace(/[\D\s\._\-]+/g,""),i=e=>new Promise(r=>setTimeout(r,e)),f=(e,r)=>{if(e.length!==r.length)return!1;for(let t=0;t<e.length;t++)if(e[t]!==r[t])return!1;return!0};export{r as allFilled,t as camelize,o as email2key,e as filled,n as getObjectKeys,p as hasProp,s as makeGetField,c as makeSetField,a as numOnly,f as shallowCompareArrays,i as sleep};
const t=t=>""!==t&&"null"!==t,e=(e,r)=>{let o;o=r?Object.keys(e).filter(t=>!r.includes(t)):Object.keys(e);for(const r of o)if(!t(e[r]))return!1;return!0},r=(t,e=!1,r="_")=>e?t.split(r).map(t=>t.toLowerCase().replace(/./,t=>t.toUpperCase())).join(""):t.split(r).map((t,e)=>e>0?t.toLowerCase().replace(/./,t=>t.toUpperCase()):t.toLowerCase()).join(""),o=t=>t.toLowerCase().replace(/[@\.]/g,"_"),s=(t,e=!0)=>{const r=[];for(const[o,n]of Object.entries(t))r.push(o),"object"!=typeof n||Array.isArray(n)||(e&&r.push("{"),s(n,e).forEach(t=>r.push(t)),e&&r.push("}"));return r},n=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class i{constructor(t,e="en",r="us"){this.getLocale=()=>this.locale,this.setLocale=t=>this.locale=t,this.getCountry=()=>this.country,this.setCountry=t=>this.country=t,this.getIndexDay=()=>"us"===this.country?1:0,this.getIndexMonth=()=>"us"===this.country?0:1,this.getFirstFieldMax=()=>"us"===this.country?12:31,this.getSecondFieldMax=()=>"us"===this.country?31:12,this.getDateFormat=()=>"us"===this.country?"MM/DD/YYYY":"DD/MM/YYYY",this.translate=(t,e="")=>{if(!n(this.resources,this.locale))return`INTERNAL_ERROR: cannot find locale ${this.locale} in resources object`;const r=this.resources[this.locale];if(!t)return"INTERNAL_ERROR: path variable must not be empty";const o=t.split(".").reduce((t,e)=>n(t,e)?t[e]:"",r);return o||(e||`INTERNAL_ERROR: cannot find message with path = ${t}`)},this.resources=t,this.locale=e,this.country=r}}const c=(t,e)=>r=>{if(!Object.prototype.hasOwnProperty.call(t,r))throw new Error(`cannot find ${r}`);const o=t[r];if(typeof o!==e)throw new Error(`type of ${r} is incorrect`);return o},a=(t,e,r)=>(o,s)=>{if(!Object.prototype.hasOwnProperty.call(t,o))throw new Error(`cannot find ${o}`);const n=t[o];if(typeof n!==r)throw new Error(`type of ${o} is incorrect`);n!==s&&(t[o]=s,e())},h=t=>t.replace(/[\D\s\._\-]+/g,""),l=t=>new Promise(e=>setTimeout(e,t)),u=(t,e)=>{if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0};export{i as Locales,e as allFilled,r as camelize,o as email2key,t as filled,s as getObjectKeys,n as hasProp,c as makeGetField,a as makeSetField,h as numOnly,u as shallowCompareArrays,l as sleep};
{
"name": "@cpmech/basic",
"version": "2.9.0",
"version": "2.9.1",
"license": "MIT",

@@ -43,3 +43,3 @@ "author": {

},
"gitHead": "440f248d287013c0cd9ee8ee91b7c0a4df740492"
"gitHead": "4534b3b516dc42837ace433b1e42cef28341374e"
}
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