@freik/node-utils
Version:
My personal set of utilities for NodeJS
2 lines (1 loc) • 1.81 kB
JavaScript
var S=Object.create;var f=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var w=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var T=(r,t)=>{for(var e in t)f(r,e,{get:t[e],enumerable:!0})},W=(r,t,e,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of I(t))!p.call(r,s)&&s!==e&&f(r,s,{get:()=>t[s],enumerable:!(c=L(t,s))||c.enumerable});return r};var b=(r,t,e)=>(e=r!=null?S(w(r)):{},W(t||!r||!r.__esModule?f(e,"default",{value:r,enumerable:!0}):e,r)),m=r=>W(f({},"__esModule",{value:!0}),r);var z={};T(z,{MakeStringWatcher:()=>C,MakeSuffixWatcher:()=>y});module.exports=m(z);var d=require("@freik/typechk"),x=b(require("path"));function C(...r){const t=new Set,e=new Set;function c(o){return t.size===0||t.has(o)}function s(o){return e.size!==0&&e.has(o)}function l(...o){for(const n of o)for(const i of(0,d.isString)(n)?[n]:n)t.add(i),e.delete(i);return this}function u(...o){for(const n of o)for(const i of(0,d.isString)(n)?[n]:n)e.add(i),t.delete(i);return this}function a(o){return!s(o)&&c(o)}return a.addToIgnoreList=u,a.addToWatchList=l,a.watching=a,r&&a.addToWatchList(r),a}function y(...r){const t=new Set,e=new Set;function c(n){return x.extname(n).toLocaleLowerCase()}function s(n){return t.size===0||t.has(c(n))}function l(n){return e.size!==0&&e.has(c(n))}function u(...n){for(const i of n)for(const g of(0,d.isString)(i)?[i]:i){const h=g.startsWith(".")?g.toLocaleLowerCase():"."+g.toLocaleLowerCase();t.add(h),e.delete(h)}return this}function a(...n){for(const i of n)for(const g of(0,d.isString)(i)?[i]:i){const h=g.startsWith(".")?g.toLocaleLowerCase():"."+g.toLocaleLowerCase();e.add(h),t.delete(h)}return this}function o(n){return!l(n)&&s(n)}return o.addToIgnoreList=a,o.addToWatchList=u,o.watching=o,r&&o.addToWatchList(r),o}