@jdeighan/coffee-utils 16.0.21 → 16.0.23

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,24 +1,19 @@
1
1
  {
2
2
  "name": "@jdeighan/coffee-utils",
3
3
  "type": "module",
4
- "version": "16.0.21",
4
+ "version": "16.0.23",
5
5
  "description": "A set of utility functions for CoffeeScript",
6
6
  "main": "coffee_utils.js",
7
7
  "exports": {
8
- ".": "./src/lib/browser.js",
8
+ ".": "./src/lib/fs.js",
9
9
  "./server": "./src/lib/server.js",
10
- "./browser": "./src/lib/browser.js",
11
10
  "./fs": "./src/lib/fs.js",
12
- "./log": "./src/lib/log.js",
11
+ "./fsa": "./src/lib/fsa.js",
13
12
  "./block": "./src/lib/block.js",
14
13
  "./indent": "./src/lib/indent.js",
15
14
  "./html": "./src/lib/html.js",
16
- "./stack": "./src/lib/stack.js",
17
- "./taml": "./src/lib/taml.js",
18
15
  "./section": "./src/lib/Section.js",
19
16
  "./sectionmap": "./src/lib/SectionMap.js",
20
- "./fsa": "./src/lib/fsa.js",
21
- "./giftset": "./src/lib/GiftSet.js",
22
17
  "./keyedset": "./src/lib/KeyedSet.js",
23
18
  "./package.json": "./package.json"
24
19
  },
@@ -46,14 +41,14 @@
46
41
  },
47
42
  "homepage": "https://github.com/johndeighan/coffee-utils#readme",
48
43
  "dependencies": {
49
- "@jdeighan/base-utils": "^8.0.22",
44
+ "@jdeighan/base-utils": "^8.0.23",
50
45
  "cross-env": "^7.0.3",
51
46
  "n-readlines": "^1.0.1",
52
47
  "readline-sync": "^1.4.10",
53
48
  "svelte": "^4.1.1"
54
49
  },
55
50
  "devDependencies": {
56
- "@jdeighan/unit-tester": "^3.0.70",
51
+ "@jdeighan/unit-tester": "^3.0.71",
57
52
  "ava": "^6.0.1"
58
53
  }
59
54
  }
@@ -12,12 +12,3 @@ export exec = (cmd) =>
12
12
  windowsHide: true
13
13
  }
14
14
  return buffer.toString()
15
-
16
- # ---------------------------------------------------------------------------
17
- # ask - ask a question
18
- # later, on a web page, prompt the user for answer to question
19
-
20
- export ask = (prompt) =>
21
-
22
- answer = getline.question("{prompt}? ")
23
- return answer
package/src/lib/server.js CHANGED
@@ -15,12 +15,3 @@ export var exec = (cmd) => {
15
15
  });
16
16
  return buffer.toString();
17
17
  };
18
-
19
- // ---------------------------------------------------------------------------
20
- // ask - ask a question
21
- // later, on a web page, prompt the user for answer to question
22
- export var ask = (prompt) => {
23
- var answer;
24
- answer = getline.question("{prompt}? ");
25
- return answer;
26
- };
@@ -1,59 +0,0 @@
1
- # browser.coffee
2
-
3
- import {undef, defined, notdefined} from '@jdeighan/base-utils'
4
- import {assert, croak} from '@jdeighan/base-utils/exceptions'
5
-
6
- audio = undef # audio context - create only when needed, then keep
7
-
8
- # ---------------------------------------------------------------------------
9
- # beep - play a sound
10
-
11
- export beep = (volume=100, freq=520, duration=200) =>
12
-
13
- if audio == undef
14
- audio = new AudioContext()
15
- v = audio.createOscillator()
16
- u = audio.createGain()
17
- v.connect(u)
18
- v.frequency.value = freq
19
- v.type = "square"
20
- u.connect(audio.destination)
21
- u.gain.value = volume * 0.01
22
- v.start(audio.currentTime)
23
- v.stop(audio.currentTime + duration * 0.001)
24
- return
25
-
26
- # ---------------------------------------------------------------------------
27
-
28
- export localStorageAvailable = () ->
29
-
30
- storage = window.localStorage
31
- if notdefined(storage)
32
- return false
33
- try
34
- x = '__storage_test__'
35
- storage.setItem x, x
36
- got = storage.getItem x
37
- storage.removeItem x
38
- return (got == x)
39
- catch e
40
- return false
41
-
42
- # ---------------------------------------------------------------------------
43
-
44
- export getLocalStore = (key, defValue={}) =>
45
-
46
- assert localStorageAvailable(), "no localStorage"
47
- if localStorage.hasOwnProperty(key)
48
- return JSON.parse(localStorage.getItem(key))
49
- else
50
- localStorage.setItem key, JSON.stringify(defValue)
51
- return defValue
52
-
53
- # ---------------------------------------------------------------------------
54
-
55
- export setLocalStore = (key, value) =>
56
-
57
- assert localStorageAvailable(), "no localStorage"
58
- localStorage.setItem key, JSON.stringify(value)
59
- return
@@ -1,71 +0,0 @@
1
- // Generated by CoffeeScript 2.7.0
2
- // browser.coffee
3
- var audio;
4
-
5
- import {
6
- undef,
7
- defined,
8
- notdefined
9
- } from '@jdeighan/base-utils';
10
-
11
- import {
12
- assert,
13
- croak
14
- } from '@jdeighan/base-utils/exceptions';
15
-
16
- audio = undef; // audio context - create only when needed, then keep
17
-
18
-
19
- // ---------------------------------------------------------------------------
20
- // beep - play a sound
21
- export var beep = (volume = 100, freq = 520, duration = 200) => {
22
- var u, v;
23
- if (audio === undef) {
24
- audio = new AudioContext();
25
- }
26
- v = audio.createOscillator();
27
- u = audio.createGain();
28
- v.connect(u);
29
- v.frequency.value = freq;
30
- v.type = "square";
31
- u.connect(audio.destination);
32
- u.gain.value = volume * 0.01;
33
- v.start(audio.currentTime);
34
- v.stop(audio.currentTime + duration * 0.001);
35
- };
36
-
37
- // ---------------------------------------------------------------------------
38
- export var localStorageAvailable = function() {
39
- var e, got, storage, x;
40
- storage = window.localStorage;
41
- if (notdefined(storage)) {
42
- return false;
43
- }
44
- try {
45
- x = '__storage_test__';
46
- storage.setItem(x, x);
47
- got = storage.getItem(x);
48
- storage.removeItem(x);
49
- return got === x;
50
- } catch (error) {
51
- e = error;
52
- return false;
53
- }
54
- };
55
-
56
- // ---------------------------------------------------------------------------
57
- export var getLocalStore = (key, defValue = {}) => {
58
- assert(localStorageAvailable(), "no localStorage");
59
- if (localStorage.hasOwnProperty(key)) {
60
- return JSON.parse(localStorage.getItem(key));
61
- } else {
62
- localStorage.setItem(key, JSON.stringify(defValue));
63
- return defValue;
64
- }
65
- };
66
-
67
- // ---------------------------------------------------------------------------
68
- export var setLocalStore = (key, value) => {
69
- assert(localStorageAvailable(), "no localStorage");
70
- localStorage.setItem(key, JSON.stringify(value));
71
- };