locutus 2.0.31 → 2.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,66 @@
1
+ # Locutus
2
+
3
+ > All your standard libraries will be assimilated into our JavaScript collective. Resistance is futile.
4
+
5
+ Welcome to Locutus, where the boundaries of coding languages blur. We're a dedicated collective developers on a mission
6
+ to explore the possibilities of porting standard libraries from various programming language (Go, Ruby, PHP, C) to
7
+ JavaScript. Our journey is one of discovery, innovation, and sometimes, delightful chaos.
8
+
9
+ From the complex to the quirky, we assimilate libraries with a spirit of curiosity and a penchant for experimentation.
10
+ Our creations typically start as rainy Sunday afternoon puzzles, and end up ranging from groundbreaking functions that
11
+ enhance the JavaScript ecosystem, to unique oddities that challenge the norms of coding.
12
+
13
+ As we navigate through this uncharted territory, we invite you to join us. Whether to contribute, learn, or simply
14
+ marvel at the wonders of cross-language integration and portability, your presence on GitHub is valued.
15
+
16
+ Embark on this journey with us at [locutus.io](https://locutus.io/).
17
+
18
+ Use our creations at your own risk, and may they inspire you to push the boundaries of what's possible with JavaScript.
19
+
20
+ ## Table of contents
21
+
22
+ - [Install](#install)
23
+ - [Use](#use)
24
+ - [Development](#development)
25
+
26
+ ## Install
27
+
28
+ ```bash
29
+ yarn add locutus
30
+ ```
31
+
32
+ ## Use
33
+
34
+ ```bash
35
+ $ vim php.js
36
+ ```
37
+
38
+ ```javascript
39
+ const sprintf = require('locutus/php/strings/sprintf')
40
+ const echo = require('locutus/php/strings/echo')
41
+ const effectiveness = 'futile'
42
+ echo(sprintf('Resistance is %s', effectiveness))
43
+ ```
44
+
45
+ ```bash
46
+ $ node php.js
47
+ Resistance is futile
48
+ ```
49
+
50
+ ```bash
51
+ $ vim go.js
52
+ ```
53
+
54
+ ```javascript
55
+ const strings = require('locutus/golang/strings')
56
+ console.log(strings.Contains('Locutus', 'cut'))
57
+ ```
58
+
59
+ ```bash
60
+ $ node go.js
61
+ true
62
+ ```
63
+
64
+ ## Development
65
+
66
+ Some guidelines and instructions can be found in [CONTRIBUTING.md](CONTRIBUTING.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "locutus",
3
- "version": "2.0.31",
3
+ "version": "2.0.32",
4
4
  "description": "Locutus other languages' standard libraries to JavaScript for fun and educational purposes",
5
5
  "keywords": [
6
6
  "php",
@@ -28,7 +28,7 @@
28
28
  "scripts": {
29
29
  "browser:bundle": "browserify test/browser/app.js --outfile test/browser/bundle.js",
30
30
  "browser:watch": "budo test/browser/app.js --live --serve test/browser/bundle.js",
31
- "build:dist": "babel src --out-dir dist --source-maps && cp package.json dist/",
31
+ "build:dist": "babel src --out-dir dist --source-maps && cp package.json README.md dist/",
32
32
  "build:indices": "babel-node src/_util/cli.js reindex",
33
33
  "build:tests:noskip": "rimraf test/generated && babel-node src/_util/cli.js writetests --noskip",
34
34
  "build:tests": "rimraf test/generated && babel-node src/_util/cli.js writetests",
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ module.exports = function file_exists(filename) {
4
+ // discuss at: https://locutus.io/php/file_exists/
5
+ // original by: Erik Niebla
6
+ // note 1: so this function is Node-only
7
+ // example 1: file_exists('test/never-change.txt')
8
+ // returns 1: true
9
+
10
+ var fs = require('fs');
11
+
12
+ return fs.existsSync(filename);
13
+ };
14
+ //# sourceMappingURL=file_exists.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/php/filesystem/file_exists.js"],"names":["module","exports","file_exists","filename","fs","require","existsSync"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,WAAT,CAAqBC,QAArB,EAA+B;AAC9C;AACA;AACA;AACA;AACA;;AAEA,MAAMC,KAAKC,QAAQ,IAAR,CAAX;;AAEA,SAAOD,GAAGE,UAAH,CAAcH,QAAd,CAAP;AACD,CAVD","file":"file_exists.js","sourcesContent":["module.exports = function file_exists(filename) {\n // discuss at: https://locutus.io/php/file_exists/\n // original by: Erik Niebla\n // note 1: so this function is Node-only\n // example 1: file_exists('test/never-change.txt')\n // returns 1: true\n\n const fs = require('fs')\n\n return fs.existsSync(filename)\n}\n"]}
@@ -2,6 +2,7 @@
2
2
 
3
3
  module.exports.basename = require('./basename');
4
4
  module.exports.dirname = require('./dirname');
5
+ module.exports.file_exists = require('./file_exists');
5
6
  module.exports.file_get_contents = require('./file_get_contents');
6
7
  module.exports.pathinfo = require('./pathinfo');
7
8
  module.exports.realpath = require('./realpath');
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/php/filesystem/index.js"],"names":["module","exports","basename","require","dirname","file_get_contents","pathinfo","realpath"],"mappings":";;AAAAA,OAAOC,OAAP,CAAeC,QAAf,GAA0BC,QAAQ,YAAR,CAA1B;AACAH,OAAOC,OAAP,CAAeG,OAAf,GAAyBD,QAAQ,WAAR,CAAzB;AACAH,OAAOC,OAAP,CAAeI,iBAAf,GAAmCF,QAAQ,qBAAR,CAAnC;AACAH,OAAOC,OAAP,CAAeK,QAAf,GAA0BH,QAAQ,YAAR,CAA1B;AACAH,OAAOC,OAAP,CAAeM,QAAf,GAA0BJ,QAAQ,YAAR,CAA1B","file":"index.js","sourcesContent":["module.exports.basename = require('./basename')\nmodule.exports.dirname = require('./dirname')\nmodule.exports.file_get_contents = require('./file_get_contents')\nmodule.exports.pathinfo = require('./pathinfo')\nmodule.exports.realpath = require('./realpath')\n"]}
1
+ {"version":3,"sources":["../../../src/php/filesystem/index.js"],"names":["module","exports","basename","require","dirname","file_exists","file_get_contents","pathinfo","realpath"],"mappings":";;AAAAA,OAAOC,OAAP,CAAeC,QAAf,GAA0BC,QAAQ,YAAR,CAA1B;AACAH,OAAOC,OAAP,CAAeG,OAAf,GAAyBD,QAAQ,WAAR,CAAzB;AACAH,OAAOC,OAAP,CAAeI,WAAf,GAA6BF,QAAQ,eAAR,CAA7B;AACAH,OAAOC,OAAP,CAAeK,iBAAf,GAAmCH,QAAQ,qBAAR,CAAnC;AACAH,OAAOC,OAAP,CAAeM,QAAf,GAA0BJ,QAAQ,YAAR,CAA1B;AACAH,OAAOC,OAAP,CAAeO,QAAf,GAA0BL,QAAQ,YAAR,CAA1B","file":"index.js","sourcesContent":["module.exports.basename = require('./basename')\nmodule.exports.dirname = require('./dirname')\nmodule.exports.file_exists = require('./file_exists')\nmodule.exports.file_get_contents = require('./file_get_contents')\nmodule.exports.pathinfo = require('./pathinfo')\nmodule.exports.realpath = require('./realpath')\n"]}