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 3.2.0 to 3.3.0

dist/esm/cloneDeepSimple.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,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,"_"),formatCPF=e=>{const t=e.replace(/[\D\s._-]+/g,"");let r=4;const s=[];for(let e=0,o=t.length;e<o;e+=r)r=e<9?3:2,s.push(t.substr(e,r));return s.length>=4?s.slice(0,3).join(".")+"-"+s[3]:s.join(".")},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.formatCPF=formatCPF,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(""),cloneDeepSimple=e=>{const t={};for(const r of Object.keys(e)){const o=e[r];Array.isArray(o)?t[r]=[...o]:t[r]="object"==typeof o?cloneDeepSimple(o):o}return t},email2key=e=>e.toLowerCase().replace(/[@\.]/g,"_"),formatCPF=e=>{const t=e.replace(/[\D\s._-]+/g,"");let r=4;const o=[];for(let e=0,s=t.length;e<s;e+=r)r=e<9?3:2,o.push(t.substr(e,r));return o.length>=4?o.slice(0,3).join(".")+"-"+o[3]:o.join(".")},getObjectKeys=(e,t=!0)=>{const r=[];for(const o of Object.keys(e)){const s=e[o];r.push(o),"object"!=typeof s||Array.isArray(s)||(t&&r.push("{"),getObjectKeys(s,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 o=e.split(".").reduce((e,t)=>hasProp(e,t)?e[t]:"",r);return o||(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 o=e[r];if(typeof o!==t)throw new Error(`type of ${r} is incorrect`);return o},makeSetField=(e,t,r)=>(o,s)=>{if(!Object.prototype.hasOwnProperty.call(e,o))throw new Error(`cannot find ${o}`);const l=e[o];if(typeof l!==r)throw new Error(`type of ${o} is incorrect`);l!==s&&(e[o]=s,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.cloneDeepSimple=cloneDeepSimple,exports.email2key=email2key,exports.filled=filled,exports.formatCPF=formatCPF,exports.getObjectKeys=getObjectKeys,exports.hasProp=hasProp,exports.makeGetField=makeGetField,exports.makeSetField=makeSetField,exports.numOnly=numOnly,exports.shallowCompareArrays=shallowCompareArrays,exports.sleep=sleep;
export * from './allFilled';
export * from './camelize';
export * from './cloneDeepSimple';
export * from './email2key';

@@ -4,0 +5,0 @@ export * from './filled';

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

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=>{const e=t.replace(/[\D\s._-]+/g,"");let r=4;const o=[];for(let t=0,s=e.length;t<s;t+=r)r=t<9?3:2,o.push(e.substr(t,r));return o.length>=4?o.slice(0,3).join(".")+"-"+o[3]:o.join(".")},n=(t,e=!0)=>{const r=[];for(const[o,s]of Object.entries(t))r.push(o),"object"!=typeof s||Array.isArray(s)||(e&&r.push("{"),n(s,e).forEach(t=>r.push(t)),e&&r.push("}"));return r},c=(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(!c(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)=>c(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 h=(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},l=(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())},a=t=>t.replace(/[\D\s\._\-]+/g,""),u=t=>new Promise(e=>setTimeout(e,t)),p=(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 formatCPF,n as getObjectKeys,c as hasProp,h as makeGetField,l as makeSetField,a as numOnly,p as shallowCompareArrays,u 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=>{const e={};for(const r of Object.keys(t)){const s=t[r];Array.isArray(s)?e[r]=[...s]:e[r]="object"==typeof s?o(s):s}return e},s=t=>t.toLowerCase().replace(/[@\.]/g,"_"),n=t=>{const e=t.replace(/[\D\s._-]+/g,"");let r=4;const o=[];for(let t=0,s=e.length;t<s;t+=r)r=t<9?3:2,o.push(e.substr(t,r));return o.length>=4?o.slice(0,3).join(".")+"-"+o[3]:o.join(".")},c=(t,e=!0)=>{const r=[];for(const o of Object.keys(t)){const s=t[o];r.push(o),"object"!=typeof s||Array.isArray(s)||(e&&r.push("{"),c(s,e).forEach(t=>r.push(t)),e&&r.push("}"))}return r},i=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);class a{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(!i(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)=>i(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 h=(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},l=(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())},u=t=>t.replace(/[\D\s\._\-]+/g,""),p=t=>new Promise(e=>setTimeout(e,t)),y=(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{a as Locales,e as allFilled,r as camelize,o as cloneDeepSimple,s as email2key,t as filled,n as formatCPF,c as getObjectKeys,i as hasProp,h as makeGetField,l as makeSetField,u as numOnly,y as shallowCompareArrays,p as sleep};
{
"name": "@cpmech/basic",
"version": "3.2.0",
"version": "3.3.0",
"license": "MIT",

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

"@types/jest": "^24.0.23",
"@types/node": "^12.12.7",
"@types/node": "^12.12.8",
"jest": "^24.9.0",

@@ -40,3 +40,3 @@ "prettier": "^1.19.1",

"ts-jest": "^24.1.0",
"ts-node": "^8.5.0",
"ts-node": "^8.5.2",
"tslint": "^5.20.1",

@@ -46,3 +46,3 @@ "tslint-config-prettier": "^1.18.0",

},
"gitHead": "72f3968e730be734484dc9c86a203ce2f2553130"
"gitHead": "cff1194eb68383f622a16d9d019b552b3534b362"
}
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